Remove loader on error

This commit is contained in:
Peter Maquiran
2021-07-15 08:59:59 +01:00
parent 5fb9f32f8e
commit ab298b30e8
@@ -234,9 +234,11 @@ export class NewEventPage implements OnInit {
let eventId: any;
const loader = this.toastService.loading()
try {
const loader = this.toastService.loading()
if(this.loggeduser.Profile == 'MDGPR') {
console.log(this.loggeduser.Profile);
@@ -245,14 +247,12 @@ export class NewEventPage implements OnInit {
eventId = await this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).toPromise();
console.log(eventId);
loader.remove()
}
else if(this.loggeduser.Profile == 'PR'){
console.log(this.loggeduser.Profile);
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
loader.remove()
}
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
@@ -284,6 +284,8 @@ export class NewEventPage implements OnInit {
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}