Skip to content

Commit

Permalink
fix: fix: Angular v14 support
Browse files Browse the repository at this point in the history
  • Loading branch information
timdeschryver committed Dec 5, 2022
1 parent 384fbc8 commit 7852ba4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { HttpEvent, HttpHandler, HttpHandlerFn, HttpInterceptor, HttpInterceptorFn, HttpRequest } from '@angular/common/http';
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { AuthStateService } from '../auth-state/auth-state.service';
import { ConfigurationService } from '../config/config.service';
import { LoggerService } from '../logging/logger.service';
import { ClosestMatchingRouteService } from './closest-matching-route.service';

// these types can be dropped when Angular 14 support is dropped (and imported from angular/common/http)
declare type HttpHandlerFn = (req: HttpRequest<unknown>) => Observable<HttpEvent<unknown>>;
declare type HttpInterceptorFn = (req: HttpRequest<unknown>, next: HttpHandlerFn) => Observable<HttpEvent<unknown>>;

@Injectable()
export class AuthInterceptor implements HttpInterceptor {
constructor(
Expand Down Expand Up @@ -73,7 +77,7 @@ function interceptRequest(

if (!token) {
deps.loggerService.logDebug(matchingConfig, `Wanted to add token to ${req.url} but found no token: '${token}'`);

return next(req);
}

Expand Down

0 comments on commit 7852ba4

Please sign in to comment.