add either pattern

This commit is contained in:
Peter Maquiran
2024-07-09 12:36:46 +01:00
parent 06417ead0f
commit a26fbbddba
45 changed files with 985 additions and 701 deletions
@@ -118,25 +118,23 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
this.agendaDataRepository.approveEvent(serialNumber).subscribe((value) => {
console.log(value)
this.modalController.dismiss(serialNumber);
this.httpErroHandle.httpsSucessMessagge('Aprovar')
this.TaskService.loadEventosParaAprovacao();
}, ((error) => {
console.log('aprove event error: ', error)
this.httpErroHandle.httpStatusHandle(error)
}))
/* await this.processes.PostTaskAction(body).toPromise() */
const result = await this.agendaDataRepository.approveEvent(serialNumber)// .subscribe((value) => {
if(result.isOk()) {
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
this.close()
loader.remove()
console.log(result.value)
this.modalController.dismiss(serialNumber);
this.httpErroHandle.httpsSucessMessagge('Aprovar')
this.TaskService.loadEventosParaAprovacao();
} else {
console.log('aprove event error: ', result.error)
this.httpErroHandle.httpStatusHandle(result.error)
}
this.close()
loader.remove()
}
async rejectTask(serialNumber: string) {
@@ -145,24 +143,20 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
const result = await this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Declined', "")//.subscribe((value) => {
try {
/* await this.processes.PostTaskAction(body).toPromise() */
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Declined', "").subscribe((value) => {
if(result.isOk()) {
this.httpErroHandle.httpsSucessMessagge('Rejeitar');
this.TaskService.loadEventosParaAprovacao();
}, ((error) => {
console.log('reject event error: ', error)
this.httpErroHandle.httpStatusHandle(error)
}))
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
this.close()
} else {
console.log('reject event error: ', result.error)
this.httpErroHandle.httpStatusHandle(result.error)
}
loader.remove()
}
@@ -235,23 +229,20 @@ export class ApproveEventPage implements OnInit {
}
const loader = this.toastService.loading();
try {
/* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Revision', res.data.note).subscribe((value) => {
/* await this.processes.PostTaskAction(body).toPromise(); */
const result = await this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Revision', res.data.note)// .subscribe((value) => {
if(result.isOk()) {
this.httpErroHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao();
this.close();
},((error) => {
console.log('send event to revision error: ', error)
this.httpErroHandle.httpStatusHandle(error)
}));
} else {
console.log('send event to revision error: ', result.error)
this.httpErroHandle.httpStatusHandle(result.error)
}
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} else {