Я пытаюсь сделать 2 http-запроса, но они на самом деле не выполняются, хотя шаг отладки указывает на то, что вызван httpclient.delete. выполнение никогда не останавливается в точке останова внутри подписки.
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()));
}
РЕДАКТИРОВАТЬ: Здесь вопрос с такой же проблемой. Однако для angular5 она устарела и реального решения не существует.