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
@@ -102,6 +102,9 @@ export class ApproveEventModalPage implements OnInit {
console.log('approveTask SERIALNUMBER: ', serialNumber)
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
@@ -112,6 +115,9 @@ export class ApproveEventModalPage implements OnInit {
} catch (error) {
this.toastService.badRequest('Evento não aprovado')
}
finally {
loader.remove()
}
}
@@ -128,6 +134,8 @@ export class ApproveEventModalPage implements OnInit {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
@@ -136,6 +144,9 @@ export class ApproveEventModalPage implements OnInit {
})
} catch (error) {
this.toastService.badRequest('Evento não rejeitado')
}
finally {
loader.remove()
}
this.modalController.dismiss(null);
@@ -183,7 +194,8 @@ export class ApproveEventModalPage implements OnInit {
}
//console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
@@ -191,6 +203,9 @@ export class ApproveEventModalPage implements OnInit {
} catch (error) {
this.toastService.badRequest()
this.router.navigate(['/home/gabinete-digital/event-list']);
}
finally {
loader.remove()
}
}
@@ -97,6 +97,8 @@ export class ApproveEventPage implements OnInit {
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage();
@@ -105,6 +107,9 @@ export class ApproveEventPage implements OnInit {
} catch (error) {
this.toastService.badRequest()
}
finally {
loader.remove()
}
/* this.approveEventDismiss.emit({
@@ -144,13 +149,18 @@ export class ApproveEventPage implements OnInit {
}
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado');
this.goBack();
} catch (error) {
this.toastService.badRequest();
} finally {
loader.remove()
}
}
else{
//this.alertService.presentAlert('Operação cancelada!');
@@ -164,6 +174,7 @@ export class ApproveEventPage implements OnInit {
async rejeitar(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
const loader = this.toastService.loading()
try {
this.processes.PostTaskAction(body).toPromise();
await this.toastService.successMessage('Processo rejeitado');
@@ -171,9 +182,14 @@ export class ApproveEventPage implements OnInit {
} catch (error) {
this.toastService.badRequest()
}
finally {
loader.remove()
}
}
async getAttachments(instanceId:string){
const loader = this.toastService.loading()
try {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(instanceId).toPromise();
@@ -233,13 +249,18 @@ export class ApproveEventPage implements OnInit {
}
console.log(body);
try {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest();
} finally {
loader.remove()
}
}
else{
//this.alertService.presentAlert('Operação cancelada!');