In the previous versions of Angular, I use finally()
just fine like the code below
constructor(
private http: Http
) { }
const headers = new Headers({ 'Authorization': this.authenticate.getToken(), 'Content-Type': 'application/json' });
const options = new RequestOptions({ headers: headers });
return this.http.put(Globals.SERVER_URL + '/alert/exempted?_id=' + alertId + '&isExempted=' + status + '&app_id=' + app_id, options )
.map(this.extractData)
.catch(this.handleError)
.finally(() => {
this.exceptionSubject.next();
});
But now when with Angular 7, I can't use it anymore. How to insert finally in the code (HttpClient)? Here is my existing code:
constructor(
private http: HttpClient
) { }
const header = new HttpHeaders({'Content-Type': 'application/json'});
return this.http.get(Globals.ATTENDANCE_URL + '/individual_employment_setting/detail/' + id, { headers: header })
.pipe(tap(resp => {
if (resp['success'] === true) {
localStorage.setItem('settings', JSON.stringify(resp['data']));
}
}
));