From fb2c30244cd012be87a458856aa03aa91e806e5d Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Thu, 8 Dec 2022 12:37:20 +0100 Subject: [PATCH] adding missing enterprise check (#2635) --- .../useProjectChangeRequests.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/hooks/api/getters/useProjectChangeRequests/useProjectChangeRequests.ts b/frontend/src/hooks/api/getters/useProjectChangeRequests/useProjectChangeRequests.ts index cd9acc9bc3..ecccc419a8 100644 --- a/frontend/src/hooks/api/getters/useProjectChangeRequests/useProjectChangeRequests.ts +++ b/frontend/src/hooks/api/getters/useProjectChangeRequests/useProjectChangeRequests.ts @@ -1,8 +1,8 @@ -import useSWR from 'swr'; import { useMemo } from 'react'; import { formatApiPath } from 'utils/formatPath'; import handleErrorResponses from '../httpErrorResponseHandler'; import useUiConfig from '../useUiConfig/useUiConfig'; +import { useEnterpriseSWR } from '../useEnterpriseSWR/useEnterpriseSWR'; const fetcher = (path: string) => { return fetch(path) @@ -11,17 +11,17 @@ const fetcher = (path: string) => { }; export const useProjectChangeRequests = (project: string) => { - const { isOss } = useUiConfig(); - const { data, error, mutate } = useSWR( + const { data, error, mutate } = useEnterpriseSWR( + [], formatApiPath(`api/admin/projects/${project}/change-requests`), - isOss() ? () => Promise.resolve([]) : fetcher + fetcher ); return useMemo( () => ({ changeRequests: data, loading: !error && !data, - refetch: () => mutate(), + refetch: mutate, error, }), [data, error, mutate]