1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

stop making enterprise calls in oss (#2449)

This commit is contained in:
Mateusz Kwasniewski 2022-11-17 09:40:47 +01:00 committed by GitHub
parent 6cd61466f3
commit f2dde9d63a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -2,11 +2,13 @@ import useSWR from 'swr';
import { formatApiPath } from 'utils/formatPath';
import handleErrorResponses from '../httpErrorResponseHandler';
import { IChangeRequestEnvironmentConfig } from 'component/changeRequest/changeRequest.types';
import useUiConfig from '../useUiConfig/useUiConfig';
export const useChangeRequestConfig = (projectId: string) => {
const { isOss } = useUiConfig();
const { data, error, mutate } = useSWR<IChangeRequestEnvironmentConfig[]>(
formatApiPath(`api/admin/projects/${projectId}/change-requests/config`),
fetcher
isOss() ? () => Promise.resolve([]) : fetcher
);
return {

View File

@ -3,6 +3,7 @@ import { useMemo } from 'react';
import { formatApiPath } from 'utils/formatPath';
import handleErrorResponses from '../httpErrorResponseHandler';
import { IChangeRequest } from 'component/changeRequest/changeRequest.types';
import useUiConfig from '../useUiConfig/useUiConfig';
const fetcher = (path: string) => {
return fetch(path)
@ -11,9 +12,10 @@ const fetcher = (path: string) => {
};
export const useChangeRequestOpen = (project: string) => {
const { isOss } = useUiConfig();
const { data, error, mutate } = useSWR<IChangeRequest[]>(
formatApiPath(`api/admin/projects/${project}/change-requests/open`),
fetcher
isOss() ? () => Promise.resolve([]) : fetcher
);
return useMemo(

View File

@ -2,6 +2,7 @@ import useSWR from 'swr';
import { useMemo } from 'react';
import { formatApiPath } from 'utils/formatPath';
import handleErrorResponses from '../httpErrorResponseHandler';
import useUiConfig from '../useUiConfig/useUiConfig';
const fetcher = (path: string) => {
return fetch(path)
@ -10,9 +11,10 @@ const fetcher = (path: string) => {
};
export const useProjectChangeRequests = (project: string) => {
const { isOss } = useUiConfig();
const { data, error, mutate } = useSWR(
formatApiPath(`api/admin/projects/${project}/change-requests`),
fetcher
isOss() ? () => Promise.resolve([]) : fetcher
);
return useMemo(