add admin navbar and brand/platform management components
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {HttpErrorResponse, HttpInterceptorFn} from '@angular/common/http';
|
||||
import {inject} from '@angular/core';
|
||||
import {AuthService} from '../../services/auth/auth.service';
|
||||
import {AuthService} from '../services/auth/auth.service';
|
||||
import {catchError, switchMap, throwError} from 'rxjs';
|
||||
|
||||
let isRefreshing = false;
|
||||
@@ -19,7 +19,7 @@ export const authTokenInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
catchError((error: any) => {
|
||||
const is401 = error instanceof HttpErrorResponse && error.status === 401;
|
||||
|
||||
// si 401 et pas déjà en refresh, tente un refresh puis rejoue la requête 1 fois
|
||||
// si 401 et pas déjà en refresh, tente un refresh puis rejoue la requête une fois
|
||||
if (is401 && !isRefreshing) {
|
||||
isRefreshing = true;
|
||||
return inject(AuthService).refresh().pipe(
|
||||
@@ -1,17 +0,0 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { HttpInterceptorFn } from '@angular/common/http';
|
||||
|
||||
import { authTokenInterceptor } from './auth-token.interceptor';
|
||||
|
||||
describe('authTokenInterceptor', () => {
|
||||
const interceptor: HttpInterceptorFn = (req, next) =>
|
||||
TestBed.runInInjectionContext(() => authTokenInterceptor(req, next));
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(interceptor).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user