diff --git a/src/App.js b/src/App.js index 12bf09d..fd6b13e 100644 --- a/src/App.js +++ b/src/App.js @@ -136,24 +136,12 @@ function App() { .then((data)=>{ if (data.data.length>0) { var newNotifications = [...notifications] - for (var not of closedNotifications) { - newNotifications = newNotifications.filter((not2)=>not2.id!==not.id) - } for (var dat of data.data) { - var exists=false - for (var not of newNotifications) { - if (not.id===dat.id) { - exists=true - break; - } - } - if (!exists) { - newNotifications.push(dat) - } + newNotifications.push(dat) } console.log("New notification array: "+JSON.stringify(newNotifications)) - setNotifications(newNotifications) setNotificationLastUpdate(new Date()) + setNotifications(newNotifications) } }) .catch((err)=>{ @@ -237,10 +225,6 @@ function App() { downloadData(d,0,d.length) setTotal(d.length) },[fileData]) - - useEffect(()=>{ - console.log(notifications) - },[notifications]) return ( @@ -290,8 +274,8 @@ function App() { }
- {notifications.map((not)=>{ - return {var newArr = closedNotifications.push(not); setClosedNotifications(newArr)}} bg="primary"> + {notifications.map((not,i)=>{ + return {var newArr = [...notifications]; newArr=newArr.splice(i,1); setNotifications(newArr)}} bg="primary"> {not.username}