Add find or return

This commit is contained in:
Peter Maquiran
2021-07-15 17:30:02 +01:00
parent 3da699e450
commit 79634e0f3a
2 changed files with 11 additions and 5 deletions
@@ -109,16 +109,20 @@ export class ViewEventPage implements OnInit {
});
}
loadEvent(){
loadEvent() {
const loader = this.toastService.loading();
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
console.log(res);
/* this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
loader.remove()
}, ()=>{
loader.remove()
this.toastService.badRequest('Este evento já não existe na sua agenda')
this.modalController.dismiss('Eevent not Foud');
this.router.navigate(['/home/agenda']);
});
}
@@ -89,7 +89,7 @@ export class ViewEventPage implements OnInit {
})
}
loadEvent(){
loadEvent() {
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
this.today = new Date(res.StartDate);
@@ -99,6 +99,8 @@ export class ViewEventPage implements OnInit {
this.viewEventDetailDismiss.emit({
type: 'close'
})
this.toastService.badRequest('Este evento já não existe na sua agenda')
})
;
}