display error message on creation if any

This commit is contained in:
tykayn 2022-03-21 15:40:08 +01:00 committed by Baptiste Lemoine
parent 0c24b2e602
commit 83e00d57f8
1 changed files with 6 additions and 3 deletions

View File

@ -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);
}
);
}