diff --git a/src/app/app.api-http.ts b/src/app/app.api-http.ts index ccf3566..1d10628 100644 --- a/src/app/app.api-http.ts +++ b/src/app/app.api-http.ts @@ -72,11 +72,6 @@ export class ApiHttp extends Http { options.headers = new Headers(); } - // Temp fix TODO: remove when fix released - if (!options.body) { - options.body = body ? body : ''; - } - options.headers.append('Content-Type', 'application/json'); let jwt = localStorage.getItem(this.JWT_KEY); @@ -96,7 +91,10 @@ export class ApiHttp extends Http { return res; }) .catch((err, source) => { - if (err.status === 401 && err.url.indexOf('login') === -1) { + // 401 for invalid token, 400 for no token, and convert + // url to string in case it is null. + if ((err.status === 401 || err.status === 400) && + (err.url + '').indexOf('login') === -1) { this.router.navigate(['']); localStorage.removeItem(this.JWT_KEY); }