import '../styles/List.css'; import config from '../config.json'; const List = ({data}) => { function deleteEntity(id) { const address = config.client.api_address + ":" + config.server.port; fetch(address + "/delete", { // Adding method type method: "DELETE", // Adding body or contents to send body: JSON.stringify({id}), // Adding headers to the request headers: { "Content-type": "application/json; charset=UTF-8", } }) .then(res => res.text()) .then(message => {console.log(message)}) } return ( {data.map((e, i) => { try { const url = new URL(e.link) return } catch (e) { console.log(e) } })}
# Name Title Link Tag
{i + 1} {e.name} {e.title} {url.hostname} {e.tag} deleteEntity(e._id)}>
) } export default List