From 83e00d57f8c8bb165bc85e94e8990bd19c64c087 Mon Sep 17 00:00:00 2001 From: tykayn Date: Mon, 21 Mar 2022 15:40:08 +0100 Subject: [PATCH] :zap: display error message on creation if any --- .../administration/nav-steps/nav-steps.component.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/features/administration/nav-steps/nav-steps.component.ts b/src/app/features/administration/nav-steps/nav-steps.component.ts index 5195475e..c18ea351 100644 --- a/src/app/features/administration/nav-steps/nav-steps.component.ts +++ b/src/app/features/administration/nav-steps/nav-steps.component.ts @@ -1,6 +1,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { PollService } from '../../../core/services/poll.service'; +import { ToastService } from 'src/app/core/services/toast.service'; @Component({ selector: 'app-nav-steps', @@ -26,7 +27,7 @@ export class NavStepsComponent implements OnInit { @Input() next_is_disabled: any = false; - constructor(private router: Router, public pollService: PollService) {} + constructor(private router: Router, private toastService: ToastService, public pollService: PollService) {} ngOnInit(): void {} @@ -45,11 +46,13 @@ export class NavStepsComponent implements OnInit { createPoll() { this.pollService.createPoll().then( (resp) => { - this.router.navigate(['/administration/success']); + console.log('resp', resp); + this.router.navigate(['/administration/success/']); this.pollService.step_current = null; }, - (err) => { + (err: any) => { console.error('oops err', err); + this.toastService.display(err.message); } ); }