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:
parent
166432bcb0
commit
cd731cef03
@ -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,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user