import '../styles/List.css'; import config from '../config'; import LazyLoad from 'react-lazyload'; 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} ({url.hostname})
{e.title}
{e.tag.map((e, i) => { return
{e}
})}
deleteEntity(e._id)}>
} catch (e) { console.log(e); } })}
) } export default List