Skip to content

Commit

Permalink
refactor: update the API url for getting scheduled change requests wi…
Browse files Browse the repository at this point in the history
…th a strategy (#5573)

Relates to enterprise PR 889; update the API url
  • Loading branch information
thomasheartman authored Dec 8, 2023
1 parent 166432b commit cd731ce
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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) => {
Expand All @@ -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,
);
Expand Down

0 comments on commit cd731ce

Please sign in to comment.