Commit 104d03443a9093ed538b1fe844e0eef1d03ac358
1 parent
76da0a0d
Fix HTTP interceptor loading state handling
Showing
1 changed file
with
8 additions
and
4 deletions
... | ... | @@ -61,8 +61,7 @@ export class GlobalHttpInterceptor implements HttpInterceptor { |
61 | 61 | intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { |
62 | 62 | if (req.url.startsWith('/api/')) { |
63 | 63 | const config = this.getInterceptorConfig(req); |
64 | - const isLoading = !this.isInternalUrlPrefix(req.url); | |
65 | - this.updateLoadingState(config, isLoading); | |
64 | + this.updateLoadingState(config, true); | |
66 | 65 | if (this.isTokenBasedAuthEntryPoint(req.url)) { |
67 | 66 | if (!AuthService.getJwtToken() && !this.authService.refreshTokenPending()) { |
68 | 67 | return this.handleResponseError(req, next, new HttpErrorResponse({error: {message: 'Unauthorized!'}, status: 401})); |
... | ... | @@ -258,11 +257,16 @@ export class GlobalHttpInterceptor implements HttpInterceptor { |
258 | 257 | } |
259 | 258 | |
260 | 259 | private getInterceptorConfig(req: HttpRequest<any>): InterceptorConfig { |
260 | + let config: InterceptorConfig; | |
261 | 261 | if (req.params && req.params instanceof InterceptorHttpParams) { |
262 | - return (req.params as InterceptorHttpParams).interceptorConfig; | |
262 | + config = (req.params as InterceptorHttpParams).interceptorConfig; | |
263 | 263 | } else { |
264 | - return new InterceptorConfig(false, false); | |
264 | + config = new InterceptorConfig(false, false); | |
265 | 265 | } |
266 | + if (this.isInternalUrlPrefix(req.url)) { | |
267 | + config.ignoreLoading = true; | |
268 | + } | |
269 | + return config; | |
266 | 270 | } |
267 | 271 | |
268 | 272 | private showError(error: string, timeout: number = 0) { | ... | ... |