Commits
Giuseppe Digilio authored 44381d76539
244 244 | } |
245 245 | |
246 246 | // Clone the request to add the new header. |
247 247 | newReq = req.clone({ headers: newHeaders }); |
248 248 | } else { |
249 249 | newReq = req.clone(); |
250 250 | } |
251 251 | |
252 252 | // Pass on the new request instead of the original request. |
253 253 | return next.handle(newReq).pipe( |
254 - | // tap((response) => console.log('next.handle: ', response)), |
255 254 | map((response) => { |
256 255 | // Intercept a Login/Logout response |
257 256 | if (response instanceof HttpResponse && this.isSuccess(response) && this.isAuthRequest(response)) { |
258 257 | // It's a success Login/Logout response |
259 258 | let authRes: HttpResponse<any>; |
260 259 | if (this.isLoginResponse(response)) { |
261 260 | // login successfully |
262 261 | const newToken = response.headers.get('authorization'); |
263 262 | authRes = response.clone({ |
264 263 | body: this.makeAuthStatusObject(true, newToken) |