import '../styles/List.css'; import config from '../config.json'; const List = ({data, reFetch}) => { function deleteEntity(id) { const address = config.api.address + ":" + config.api.port; fetch(address + "/api", { // 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)}) .then(() => reFetch()) } return (
{data.map((e, i) => { try { const url = new URL(e.link); const favicon = 'http://www.google.com/s2/favicons?domain=' + url.hostname; return
{i + 1}. {e.name}
{e.title}
{url.hostname}
{e.tag}
deleteEntity(e._id)}>
} catch (e) { console.log(e); } })}
) } export default List