I try to make 2 http-requests but they are not really made even though the debug stepping indicates that httpclient.delete is called. the execution never stops in breakpoint inside subscribe.
app.component.ts
@HostListener('window:unload', ['$event'])
unloadHandler() {
this.tabService.closeMainWindow();
}
tab-manager.service.ts
closeMainWindow(): void {
if (this.windowId === this.sessionId) {
this.closeWindows();
this.logout().subscribe(
() => this.initCache.emptyCache(),
err => console.error('Deleting plan session resulted in error', err));
}
}
private logout() {
const ses = this.ngRedux.getState().planning.planSession;
if (ses !== null) {
return this.httpClient.delete<IPlanSession>(`${this.url}/${ses.id}`).pipe(
concatMap(() => this.httpClient.post('api/v1/auth/logout', null).pipe(
tap(() => this.tokenService.logout()))));
}
return this.httoClient.post('api/v1/auth/logout', null).pipe(
tap(() => this.tokenService.logout()));
}
EDIT: Here is a question with same problem. However it's old for angular5 and there's no real solution.