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:
parent
6cd61466f3
commit
f2dde9d63a
@ -2,11 +2,13 @@ import useSWR from 'swr';
|
|||||||
import { formatApiPath } from 'utils/formatPath';
|
import { formatApiPath } from 'utils/formatPath';
|
||||||
import handleErrorResponses from '../httpErrorResponseHandler';
|
import handleErrorResponses from '../httpErrorResponseHandler';
|
||||||
import { IChangeRequestEnvironmentConfig } from 'component/changeRequest/changeRequest.types';
|
import { IChangeRequestEnvironmentConfig } from 'component/changeRequest/changeRequest.types';
|
||||||
|
import useUiConfig from '../useUiConfig/useUiConfig';
|
||||||
|
|
||||||
export const useChangeRequestConfig = (projectId: string) => {
|
export const useChangeRequestConfig = (projectId: string) => {
|
||||||
|
const { isOss } = useUiConfig();
|
||||||
const { data, error, mutate } = useSWR<IChangeRequestEnvironmentConfig[]>(
|
const { data, error, mutate } = useSWR<IChangeRequestEnvironmentConfig[]>(
|
||||||
formatApiPath(`api/admin/projects/${projectId}/change-requests/config`),
|
formatApiPath(`api/admin/projects/${projectId}/change-requests/config`),
|
||||||
fetcher
|
isOss() ? () => Promise.resolve([]) : fetcher
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -3,6 +3,7 @@ import { useMemo } from 'react';
|
|||||||
import { formatApiPath } from 'utils/formatPath';
|
import { formatApiPath } from 'utils/formatPath';
|
||||||
import handleErrorResponses from '../httpErrorResponseHandler';
|
import handleErrorResponses from '../httpErrorResponseHandler';
|
||||||
import { IChangeRequest } from 'component/changeRequest/changeRequest.types';
|
import { IChangeRequest } from 'component/changeRequest/changeRequest.types';
|
||||||
|
import useUiConfig from '../useUiConfig/useUiConfig';
|
||||||
|
|
||||||
const fetcher = (path: string) => {
|
const fetcher = (path: string) => {
|
||||||
return fetch(path)
|
return fetch(path)
|
||||||
@ -11,9 +12,10 @@ const fetcher = (path: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useChangeRequestOpen = (project: string) => {
|
export const useChangeRequestOpen = (project: string) => {
|
||||||
|
const { isOss } = useUiConfig();
|
||||||
const { data, error, mutate } = useSWR<IChangeRequest[]>(
|
const { data, error, mutate } = useSWR<IChangeRequest[]>(
|
||||||
formatApiPath(`api/admin/projects/${project}/change-requests/open`),
|
formatApiPath(`api/admin/projects/${project}/change-requests/open`),
|
||||||
fetcher
|
isOss() ? () => Promise.resolve([]) : fetcher
|
||||||
);
|
);
|
||||||
|
|
||||||
return useMemo(
|
return useMemo(
|
||||||
|
@ -2,6 +2,7 @@ import useSWR from 'swr';
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { formatApiPath } from 'utils/formatPath';
|
import { formatApiPath } from 'utils/formatPath';
|
||||||
import handleErrorResponses from '../httpErrorResponseHandler';
|
import handleErrorResponses from '../httpErrorResponseHandler';
|
||||||
|
import useUiConfig from '../useUiConfig/useUiConfig';
|
||||||
|
|
||||||
const fetcher = (path: string) => {
|
const fetcher = (path: string) => {
|
||||||
return fetch(path)
|
return fetch(path)
|
||||||
@ -10,9 +11,10 @@ const fetcher = (path: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useProjectChangeRequests = (project: string) => {
|
export const useProjectChangeRequests = (project: string) => {
|
||||||
|
const { isOss } = useUiConfig();
|
||||||
const { data, error, mutate } = useSWR(
|
const { data, error, mutate } = useSWR(
|
||||||
formatApiPath(`api/admin/projects/${project}/change-requests`),
|
formatApiPath(`api/admin/projects/${project}/change-requests`),
|
||||||
fetcher
|
isOss() ? () => Promise.resolve([]) : fetcher
|
||||||
);
|
);
|
||||||
|
|
||||||
return useMemo(
|
return useMemo(
|
||||||
|
Loading…
Reference in New Issue
Block a user