I have this code:
this.userService.register(value).pipe(
finalize(() => this.isRequesting = false)
).subscribe(
() => this.router.navigate(['/login'], { queryParams: { brandNew: true, email: value.email } }),
(error: any) => this.errors = error
);
It doesn't work until I put a semicolon before this.router
:
() => ; this.router.navigate(['/login'], { queryParams: { brandNew: true, email: value.email } }),
It is really weird, why should this be happening? It has nothing to do with this.router.navigate
because if I replace it by an alert like this alert('alert')
it doesn't work again until I put a semi-colon before it. It seems really odd to me, would you please help me with this?
Also the error that it throws is just a simple [object Object]
which makes me more confused, I have also looked at this question but changing the browser to chrome had no effect: Resolver Emitting Error ` ERROR Error: "[object Object]" `
This is the register method of the userservice:
register(userRegistration: UserRegistration): Observable<{}> {
let headers = new HttpHeaders({ 'Content-Type': 'application/json' });
return this.http.post(this.baseUrl + "/account", userRegistration, { headers: headers });
}