diff --git a/frontend/src/hooks/api/getters/useChangeRequestConfig/useChangeRequestConfig.ts b/frontend/src/hooks/api/getters/useChangeRequestConfig/useChangeRequestConfig.ts index f3b93accf7..9f5f7b77a3 100644 --- a/frontend/src/hooks/api/getters/useChangeRequestConfig/useChangeRequestConfig.ts +++ b/frontend/src/hooks/api/getters/useChangeRequestConfig/useChangeRequestConfig.ts @@ -1,12 +1,15 @@ import { formatApiPath } from 'utils/formatPath'; import handleErrorResponses from '../httpErrorResponseHandler'; import { IChangeRequestEnvironmentConfig } from 'component/changeRequest/changeRequest.types'; -import { useEnterpriseSWR } from '../useEnterpriseSWR/useEnterpriseSWR'; +import { useConditionalSWR } from '../useConditionalSWR/useConditionalSWR'; +import useUiConfig from '../useUiConfig/useUiConfig'; export const useChangeRequestConfig = (projectId: string) => { - const { data, error, mutate } = useEnterpriseSWR< + const { isEnterprise } = useUiConfig(); + const { data, error, mutate } = useConditionalSWR< IChangeRequestEnvironmentConfig[] >( + Boolean(projectId) && isEnterprise(), [], formatApiPath(`api/admin/projects/${projectId}/change-requests/config`), fetcher