Added fully archive support!
This commit is contained in:
+9
-23
@@ -1,28 +1,9 @@
|
||||
import '../styles/List.css';
|
||||
import config from '../config';
|
||||
import LazyLoad from 'react-lazyload';
|
||||
import ViewArchived from './ViewArchived';
|
||||
import deleteEntity from '../modules/deleteEntity';
|
||||
|
||||
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 (
|
||||
<div className="list">
|
||||
{data.map((e, i) => {
|
||||
@@ -34,7 +15,9 @@ const List = ({data, reFetch}) => {
|
||||
<div className="img-content-grp">
|
||||
<img src={favicon} />
|
||||
<div className="list-entity-content">
|
||||
<div className='row-name'><span className="num">{i + 1}.</span> {e.name} <a target="_blank" href={e.link}>({url.hostname})</a></div>
|
||||
<div className='row-name'>
|
||||
<span className="num">{i + 1}.</span> {e.name} <a target="_blank" href={e.link}>({url.hostname})</a>
|
||||
</div>
|
||||
<div>{e.title}</div>
|
||||
<div className="tags">
|
||||
{e.tag.map((e, i) => {
|
||||
@@ -43,7 +26,10 @@ const List = ({data, reFetch}) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="delete" onClick={() => deleteEntity(e._id)}></div>
|
||||
<div className='options'>
|
||||
<ViewArchived className='view-archived' id={e._id} />
|
||||
<div className="delete" onClick={() => deleteEntity(e._id, reFetch)}></div>
|
||||
</div>
|
||||
</div>
|
||||
</LazyLoad>
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user