Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
fix(logout): Fix Fix broken logout redirection
Browse files Browse the repository at this point in the history
Fixes #525
  • Loading branch information
wowshakhov committed Sep 18, 2017
1 parent 6aca008 commit ccb3401
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpResponse } from '@angular/common/http';
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import '../style/app.scss';
Expand Down Expand Up @@ -54,7 +54,7 @@ export class AppComponent implements OnInit {
}

private handleError(e: any): void {
if (e instanceof HttpResponse) {
if (e instanceof HttpErrorResponse) {
switch (e.status) {
case 401:
this.notification.message('AUTH.NOT_LOGGED_IN');
Expand Down
8 changes: 3 additions & 5 deletions src/app/shared/services/base-backend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ export abstract class BaseBackendService<M extends BaseModel> {
return result[responseKeys[0]];
}


protected postRequest(command: string, params?: {}): Observable<any> {
const headers = new HttpHeaders().set('Content-Type','application/x-www-form-urlencoded');
const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded');
return this.http.post(BACKEND_API_URL, this.buildParams(command, params), { headers })
.catch(error => this.handleError(error));
}
Expand Down Expand Up @@ -196,9 +195,8 @@ export abstract class BaseBackendService<M extends BaseModel> {
return apiCommand;
}

private handleError(response): Observable<any> {
const error = response.json();
this.error.next(response);
private handleError(error: any): Observable<any> {
this.error.next(error);
return Observable.throw(error);
}

Expand Down

0 comments on commit ccb3401

Please sign in to comment.