Improve loader

This commit is contained in:
Peter Maquiran
2021-07-12 11:13:29 +01:00
parent c526426aec
commit 507ebd691a
34 changed files with 400 additions and 32 deletions
@@ -81,12 +81,16 @@ export class ApproveEventPage implements OnInit {
async approveTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.modalController.dismiss(serialNumber);
this.toastService.successMessage()
} catch (error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
/* this.approveEventDismiss.emit({
@@ -105,12 +109,16 @@ export class ApproveEventPage implements OnInit {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.toastService.successMessage('Evento rejeitado')
} catch (error) {
this.toastService.badRequest('Processo não efectuado')
} finally {
loader.remove()
}
}
@@ -165,6 +173,7 @@ export class ApproveEventPage implements OnInit {
}
}
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
@@ -172,6 +181,8 @@ export class ApproveEventPage implements OnInit {
this.close();
} catch (error) {
this.toastService.badRequest();
} finally {
loader.remove()
}
}
else{