diff options
Diffstat (limited to 'client/src/app/core/auth/auth.service.ts')
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 0db197f02..e887dde1f 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -169,19 +169,15 @@ export class AuthService { | |||
169 | 169 | ||
170 | return this.http.post<UserRefreshToken>(AuthService.BASE_TOKEN_URL, body, { headers }) | 170 | return this.http.post<UserRefreshToken>(AuthService.BASE_TOKEN_URL, body, { headers }) |
171 | .map(res => this.handleRefreshToken(res)) | 171 | .map(res => this.handleRefreshToken(res)) |
172 | .catch(res => { | 172 | .catch(err => { |
173 | // The refresh token is invalid? | 173 | console.error(err) |
174 | if (res.status === 400 && res.error.error === 'invalid_grant') { | 174 | console.log('Cannot refresh token -> logout...') |
175 | console.error('Cannot refresh token -> logout...') | 175 | this.logout() |
176 | this.logout() | 176 | this.router.navigate(['/login']) |
177 | this.router.navigate(['/login']) | 177 | |
178 | 178 | return Observable.throw({ | |
179 | return Observable.throw({ | 179 | error: 'You need to reconnect.' |
180 | error: 'You need to reconnect.' | 180 | }) |
181 | }) | ||
182 | } | ||
183 | |||
184 | return this.restExtractor.handleError(res) | ||
185 | }) | 181 | }) |
186 | } | 182 | } |
187 | 183 | ||