MOBILE-2890 calendar: Confirm delete reminder

main
Albert Gasset 2019-10-01 15:31:52 +02:00
parent 9884da00d4
commit 922429e0d1
1 changed files with 15 additions and 3 deletions

View File

@ -344,10 +344,22 @@ export class AddonCalendarEventPage implements OnDestroy {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.calendarProvider.deleteEventReminder(id).then(() => { const message = this.translate.instant('core.areyousure');
this.calendarProvider.getEventReminders(this.eventId).then((reminders) => { const okText = this.translate.instant('core.delete');
this.reminders = reminders;
this.domUtils.showConfirm(message, undefined, okText).then(() => {
const modal = this.domUtils.showModalLoading('core.deleting', true);
this.calendarProvider.deleteEventReminder(id).then(() => {
this.calendarProvider.getEventReminders(this.eventId).then((reminders) => {
this.reminders = reminders;
});
}).catch((error) => {
this.domUtils.showErrorModalDefault(error, 'Error deleting reminder');
}).finally(() => {
modal.dismiss();
}); });
}).catch(() => {
// Cancelled.
}); });
} }