mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
duplication of notification solved
This commit is contained in:
@@ -163,7 +163,23 @@ export class NotificationsService {
|
||||
this.storageService.get("Notifications").then((store) => {
|
||||
|
||||
store.push(notification)
|
||||
this.storageService.store("Notifications", store)
|
||||
console.log('Store Notification ',store)
|
||||
|
||||
const result = store.reduce((accumulator, current) => {
|
||||
let exists = accumulator.find(item => {
|
||||
return item.id === current.id;
|
||||
});
|
||||
if(!exists) {
|
||||
accumulator = accumulator.concat(current);
|
||||
}
|
||||
return accumulator;
|
||||
}, []);
|
||||
|
||||
console.log(result);
|
||||
|
||||
|
||||
|
||||
this.storageService.store("Notifications", result)
|
||||
}).catch((error) => {
|
||||
if (!error) {
|
||||
this.storageService.store("Notifications", [notification])
|
||||
|
||||
Reference in New Issue
Block a user