mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Add delete notification and loader
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-actions-options',
|
||||
@@ -15,6 +16,7 @@ export class ActionsOptionsPage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private navParams: NavParams,
|
||||
private publicationsService: PublicationsService,
|
||||
private toastService: ToastService
|
||||
) {
|
||||
this.id = this.navParams.get('id');
|
||||
}
|
||||
@@ -30,9 +32,21 @@ export class ActionsOptionsPage implements OnInit {
|
||||
this.modalController.dismiss('edit');
|
||||
}
|
||||
|
||||
deleteAction(){
|
||||
this.publicationsService.DeletePresidentialAction(this.id).toPromise();
|
||||
this.modalController.dismiss('delete');
|
||||
async deleteAction() {
|
||||
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
try {
|
||||
await this.publicationsService.DeletePresidentialAction(this.id).toPromise();
|
||||
this.modalController.dismiss('delete');
|
||||
} catch(e) {
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user