Skip to content

Commit 21fcb10

Browse files
Interceptor checks wether url exists
1 parent c19c241 commit 21fcb10

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

projects/angular-token/src/lib/angular-token.interceptor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ export class AngularTokenInterceptor implements HttpInterceptor {
4444

4545
// Parse Auth data from response
4646
private handleResponse(res: any): void {
47-
if ((res instanceof HttpResponse || res instanceof HttpErrorResponse) && (this.tokenService.apiBase === null || res.url.match(this.tokenService.apiBase))) {
47+
if (res instanceof HttpResponse || res instanceof HttpErrorResponse) {
48+
if (this.tokenService.apiBase === null || (res.url && res.url.match(this.tokenService.apiBase))) {
4849
this.tokenService.getAuthHeadersFromResponse(<any>res);
50+
}
4951
}
5052
}
5153
}

0 commit comments

Comments
 (0)