From ce9c83513c9ef99017eb7be6464e73480f6b5446 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Fri, 19 Jun 2020 15:28:45 +0200
Subject: [PATCH] fix double request error

---
 src/frontend/service/auth-interceptor.service.ts | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/frontend/service/auth-interceptor.service.ts b/src/frontend/service/auth-interceptor.service.ts
index 587f242e1ce..dbf2a843d06 100644
--- a/src/frontend/service/auth-interceptor.service.ts
+++ b/src/frontend/service/auth-interceptor.service.ts
@@ -1,5 +1,5 @@
 import { Injectable } from '@angular/core';
-import { HttpHandler, HttpInterceptor, HttpRequest, HttpClient } from '@angular/common/http';
+import { HttpHandler, HttpInterceptor, HttpRequest, HttpClient, HttpErrorResponse } from '@angular/common/http';
 import { LANG } from '../app/translate.component';
 import { catchError, switchMap } from 'rxjs/operators';
 import { NotificationService } from '../app/notification.service';
@@ -124,7 +124,14 @@ export class AuthInterceptor implements HttpInterceptor {
                     } else if (error.error.errors === 'User must change his password') {
                         return this.router.navigate(['/password-modification']);
                     } else {
-                        return next.handle(request);
+                        const response = new HttpErrorResponse({
+                            error: error.error,
+                            status: error.status,
+                            statusText: error.statusText,
+                            headers: error.headers,
+                            url: error.url,
+                        });
+                        return Promise.reject(response);
                     }
                 })
             );
-- 
GitLab