mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
duplication of notification solved
This commit is contained in:
@@ -103,6 +103,7 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
this.DataArray = []
|
||||
value.forEach((element, i) => {
|
||||
console.log('Getnotifications',element, i )
|
||||
let notificationObject;
|
||||
if (element.notification) {
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
|
||||
this.changeProfileService.runLogin();
|
||||
this.getToken();
|
||||
/* this.getToken(); */
|
||||
SessionStore.setInativity(true);
|
||||
|
||||
this.goback();
|
||||
|
||||
@@ -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