diff --git a/package.json b/package.json index 8794071c4..0dc412623 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "0.0.48", + "version": "0.0.49", "description": "Supporting common component library", "main": "dist/index.js", "scripts": { diff --git a/src/Common/Api.ts b/src/Common/Api.ts index 798e226d7..7a722b2e4 100644 --- a/src/Common/Api.ts +++ b/src/Common/Api.ts @@ -1,5 +1,5 @@ import { ServerErrors } from './ServerError' -import { RequestTimeout, Host, URLS } from './Constants' +import { FALLBACK_REQUEST_TIMEOUT, Host, URLS } from './Constants' import { ResponseType, APIOptions } from './Types' const responseMessages = { @@ -176,7 +176,9 @@ function fetchInTime( const controller = new AbortController() const { signal } = controller const timeoutPromise: Promise = new Promise((resolve, reject) => { - let timeout = options?.timeout ? options.timeout : RequestTimeout + const requestTimeout = (window as any)?._env_?.GLOBAL_API_TIMEOUT ?? FALLBACK_REQUEST_TIMEOUT + const timeout = options?.timeout ? options.timeout : requestTimeout + setTimeout(() => { controller.abort() reject({ diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index bc231a88b..71159bc65 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -1,6 +1,6 @@ import { RegistryTypeDetailType } from "./Types" -export const RequestTimeout = 60000 +export const FALLBACK_REQUEST_TIMEOUT = 60000 export const Host = process.env.REACT_APP_ORCHESTRATOR_ROOT export const DOCUMENTATION_HOME_PAGE = 'https://docs.devtron.ai'