From 28a69eaa27fe1da0cfbc9fcf956f199e77e0a293 Mon Sep 17 00:00:00 2001 From: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Date: Thu, 6 Mar 2025 17:32:43 +0530 Subject: [PATCH] chore(ui): add loggedInAPI to show actual error instead generic one (#20110) --- .../ui/src/components/Auth/AuthProviders/AuthProvider.tsx | 3 ++- .../src/main/resources/ui/src/constants/Auth.constants.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Auth/AuthProviders/AuthProvider.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Auth/AuthProviders/AuthProvider.tsx index aa1c3a2b99d..0b7e25d9670 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Auth/AuthProviders/AuthProvider.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Auth/AuthProviders/AuthProvider.tsx @@ -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(); diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/Auth.constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/Auth.constants.ts index 7aca9f4a9f1..0c2e93a0ab5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/Auth.constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/Auth.constants.ts @@ -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', +];