mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
Conditionally fetch change request config to fix 404 (#2874)
This commit is contained in:
parent
fb11a892f0
commit
aa19ad57eb
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user