This commit is contained in:
Peter Maquiran
2023-01-05 12:11:50 +01:00
parent 0d485672d8
commit 572ab6db7b
12 changed files with 165 additions and 88 deletions
+55 -48
View File
@@ -76,53 +76,60 @@ export class ProfilePage implements OnInit {
asyncNotification() { }
async getNotificationData() {
this.storageservice.get("Notifications").then((value) => {
console.log('profile',this.storageservice.key("Notifications"))
const keyExist = await this.storageservice.keyExist("Notifications")
if(keyExist) {
this.storageservice.get("Notifications").then((value) => {
this.DataArray = []
value.forEach((element, i) => {
let notificationObject;
if (element.data) {
notificationObject = {
index: i,
title: element.title,
Service: element.data.Service,
Object: element.data.Object,
IdObject: element.data.IdObject,
FolderId: element.data.FolderId,
body: element.body,
dateInit: this.getFormatedTime(element.data.dateInit),
dateEnd: this.getFormatedTime(element.data.dateEnd),
Location: element.data.Location,
TypeAgenda: element.data.TypeAgenda,
Role: element.data.Role,
Status: element.data.Status
}
} else {
notificationObject = {
FolderId: element.FolderId,
IdObject: element.IdObject,
Location: element.Location,
Object: element.Object,
Role: element.Role,
Service: element.Service,
Status: element.Status,
TypeAgenda: element.TypeAgenda,
body: element.body,
dateEnd: element.dateEnd,
dateInit: element.dateInit,
index: element.index,
title: element.title
}
}
this.DataArray.push(notificationObject)
});
this.notificationdata = this.DataArray
}).catch((error) => {
console.error('storage getnotification: ',error)
})
}
this.DataArray = []
value.forEach((element, i) => {
let notificationObject;
if (element.data) {
notificationObject = {
index: i,
title: element.title,
Service: element.data.Service,
Object: element.data.Object,
IdObject: element.data.IdObject,
FolderId: element.data.FolderId,
body: element.body,
dateInit: this.getFormatedTime(element.data.dateInit),
dateEnd: this.getFormatedTime(element.data.dateEnd),
Location: element.data.Location,
TypeAgenda: element.data.TypeAgenda,
Role: element.data.Role,
Status: element.data.Status
}
} else {
notificationObject = {
FolderId: element.FolderId,
IdObject: element.IdObject,
Location: element.Location,
Object: element.Object,
Role: element.Role,
Service: element.Service,
Status: element.Status,
TypeAgenda: element.TypeAgenda,
body: element.body,
dateEnd: element.dateEnd,
dateInit: element.dateInit,
index: element.index,
title: element.title
}
}
this.DataArray.push(notificationObject)
});
this.notificationdata = this.DataArray
}).catch((error) => {
console.error('storage getnotification: ',error)
})
/* await new Promise(resolve => setTimeout(resolve, 1000));
await this.getNotificationData(); */
}
@@ -216,12 +223,12 @@ export class ProfilePage implements OnInit {
setTimeout(() => {
// alert('logout')
this.router.navigateByUrl('/', { replaceUrl: true });
this.router.navigate(['/']);
this.router.navigateByUrl('/auth', { replaceUrl: true });
this.router.navigate(['/auth']);
setTimeout(() =>{
if(this.logoutOut == false) {
window.location.pathname = '/'
window.location.pathname = '/auth'
}
}, 500)