chore(ui): add loggedInAPI to show actual error instead generic one (#20110)

This commit is contained in:
Chirag Madlani 2025-03-06 17:32:43 +05:30 committed by GitHub
parent 064b43f2e0
commit 28a69eaa27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import React, {
} from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import { UN_AUTHORIZED_EXCLUDED_PATHS } from '../../../constants/Auth.constants';
import {
DEFAULT_DOMAIN_VALUE,
ES_MAX_PAGE_SIZE,
@ -524,7 +525,7 @@ export const AuthProvider = ({
if (status === ClientErrors.UNAUTHORIZED) {
// For login or refresh we don't want to fire another refresh req
// Hence rejecting it
if (['/users/refresh', '/users/login'].includes(error.config.url)) {
if (UN_AUTHORIZED_EXCLUDED_PATHS.includes(error.config.url)) {
return Promise.reject(error as Error);
}
handleStoreProtectedRedirectPath();

View File

@ -32,3 +32,9 @@ export const HTTP_STATUS_CODE = {
FAILED_DEPENDENCY: 424, // The method could not be performed on the resource because the requested action depended on another action and that action failed.
LIMIT_REACHED: 429, // Entity creation limit reached
};
export const UN_AUTHORIZED_EXCLUDED_PATHS = [
'/users/refresh',
'/users/login',
'/users/loggedInUser',
];