import React, { Fragment } from 'react'; import { Link, Redirect } from 'react-router-dom'; import { parse } from 'query-string'; import PropTypes from 'prop-types'; import Sidebar from './sidebar'; import InfoBox from '../components/info-box'; import { BackIcon }from '../components/icons'; import DataEntry from './data-components/data-entry'; import { dataFields } from '../data_fields'; const MultiEdit = (props) => { if (!props.user){ return } const cat = props.match.params.cat; if (cat === 'like') { // special case for likes return (

Like me!

Back to view Back to edit
); } const q = parse(props.location.search); let data: object; if (cat === 'like'){ data = { like: true } } else { try { // TODO: verify what happens if data is string[] data = JSON.parse(q.data as string); } catch (error) { console.error(error, q) data = {} } } return (

Copy {cat} data

{ Object.keys(data).map((key => { const info = dataFields[key] || {}; return ( ) })) }
Back to view Back to edit
); } MultiEdit.propTypes = { user: PropTypes.object, match: PropTypes.object, location: PropTypes.object } export default MultiEdit;