diff --git a/src/main/ts/src/app/core/interceptors/unauthorized.interceptor.ts b/src/main/ts/src/app/core/interceptors/unauthorized.interceptor.ts index 5610e41..0207776 100644 --- a/src/main/ts/src/app/core/interceptors/unauthorized.interceptor.ts +++ b/src/main/ts/src/app/core/interceptors/unauthorized.interceptor.ts @@ -6,6 +6,8 @@ import { catchError } from 'rxjs/operators'; import { AuthService } from '../services/auth.service'; import { NotificationsComponent } from '../notifications/notifications.component'; +const REG_URL_LOGIN = /^https?:\/\/.*(:\d{1,5})?\/api\/account\/login$/; + @Injectable() export class UnauthorizedInterceptor implements HttpInterceptor { constructor( @@ -18,7 +20,9 @@ export class UnauthorizedInterceptor implements HttpInterceptor { if (err.status === 401) { this.authService.setAnonymous(); this.router.navigate(['/login']); - window.setTimeout(() => NotificationsComponent.error('Veuillez vous authentifier pour réaliser cette action.'), 500); + if (!err.url.match(REG_URL_LOGIN)) { + window.setTimeout(() => NotificationsComponent.error('Veuillez vous authentifier pour réaliser cette action.'), 500); + } } const error = (err.error && err.error.message) || err.statusText;