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

refactor: update the API url for getting scheduled change requests with a strategy (#5573)

Relates to enterprise PR 889; update the API url
This commit is contained in:
Thomas Heartman 2023-12-08 12:29:54 +01:00 committed by GitHub
parent 166432bcb0
commit cd731cef03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
import { formatApiPath } from 'utils/formatPath';
import handleErrorResponses from '../httpErrorResponseHandler';
import { IChangeRequest } from 'component/changeRequest/changeRequest.types';
import { useEnterpriseSWR } from '../useEnterpriseSWR/useEnterpriseSWR';
const fetcher = (path: string) => {
@ -9,14 +8,21 @@ const fetcher = (path: string) => {
.then((res) => res.json());
};
type ChangeRequestIdentityData = {
id: number;
title?: string;
};
export const useScheduledChangeRequestsWithStrategy = (
project: string,
strategyId: string,
) => {
const { data, error, mutate } = useEnterpriseSWR<IChangeRequest[]>(
const { data, error, mutate } = useEnterpriseSWR<
ChangeRequestIdentityData[]
>(
[],
formatApiPath(
`api/admin/projects/${project}/change-requests/scheduled/with-strategy/${strategyId}`,
`api/admin/projects/${project}/change-requests/scheduled?strategyId=${strategyId}`,
),
fetcher,
);