fix: do not resend the request if it is not necessary
All checks were successful
Build and Deploy Angular App / build (push) Successful in 1m20s

Signed-off-by: Polianin Nikita <wesser@noreply.git.winsomnia.net>
This commit is contained in:
Polianin Nikita 2024-12-26 10:40:27 +03:00
parent 90fca336f5
commit a8b1485b0e

View File

@ -68,7 +68,7 @@ export default abstract class ApiService {
body: request.data, body: request.data,
}).pipe( }).pipe(
catchError(error => { catchError(error => {
if (!secondTry && error.status === 401) if (request.needAuth && !secondTry && error.status === 401)
return this.handle401Error(error).pipe( return this.handle401Error(error).pipe(
switchMap(() => this.sendHttpRequest<Type>(method, request, true)) switchMap(() => this.sendHttpRequest<Type>(method, request, true))
); );