import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import autobind from 'autobind-decorator'; import {Cookie} from 'tough-cookie'; import {cookieToString} from '../../common/cookies'; import PromptButton from './base/prompt-button'; import RenderedText from './rendered-text'; @autobind class CookieList extends PureComponent { _handleCookieAdd () { const newCookie = new Cookie({ key: 'foo', value: 'bar', domain: this.props.newCookieDomainName, path: '/', secure: false, httpOnly: false }); this.props.onCookieAdd(newCookie); } _handleDeleteCookie (cookie) { this.props.onCookieDelete(cookie); } render () { const { cookies, handleShowModifyCookieModal, handleRender } = this.props; return (
{cookies.map((cookie, i) => { const cookieString = cookieToString(Cookie.fromJSON(JSON.stringify(cookie))); return ( {cookie.domain} {cookieString} ); })}
Domain Cookie
{' '} this._handleDeleteCookie(cookie)} title="Delete cookie">
{cookies.length === 0 && (

I couldn't find any cookies for you.

)}
); } } CookieList.propTypes = { onCookieAdd: PropTypes.func.isRequired, onCookieDelete: PropTypes.func.isRequired, cookies: PropTypes.array.isRequired, newCookieDomainName: PropTypes.string.isRequired, handleShowModifyCookieModal: PropTypes.func.isRequired, handleRender: PropTypes.func.isRequired }; export default CookieList;