I have an ApiService in Angular 6 with the following function:
add(data, string: string, type): Observable<Object | Response> {
return this._http.post(this.url + string, data).pipe(
tap(() => this.log(`added ${type} successfully`)),
catchError(this.handleError<Response>(`Adding ${type}`))
);
}
This function is called in a component as follows:
this.api.add(this.parent, 'parents/new', 'Parent').subscribe(() => {
this.authService.login(this.user, 'login').subscribe();
this.router.navigate(['/register/student']);
});
The calls to the api are not firing at all even though I've subscribed to the Observable. Please help me out guys. Thank you