Feature/workflow history (#3432)

Co-authored-by: Shuchang Zheng <wintonzheng0325@gmail.com>
This commit is contained in:
Alex Angin
2025-09-21 02:48:27 -04:00
committed by GitHub
parent 9a9ee01253
commit 0b47482fcb
19 changed files with 1387 additions and 67 deletions

View File

@@ -0,0 +1,27 @@
import { getClient } from "@/api/AxiosClient";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { useQuery } from "@tanstack/react-query";
import { WorkflowApiResponse } from "../types/workflowTypes";
type Props = {
workflowPermanentId?: string;
};
export type WorkflowVersion = WorkflowApiResponse;
function useWorkflowVersionsQuery({ workflowPermanentId }: Props) {
const credentialGetter = useCredentialGetter();
return useQuery<WorkflowVersion[]>({
queryKey: ["workflowVersions", workflowPermanentId],
queryFn: async () => {
const client = await getClient(credentialGetter);
return client
.get(`/workflows/${workflowPermanentId}/versions`)
.then((response) => response.data);
},
enabled: !!workflowPermanentId,
});
}
export { useWorkflowVersionsQuery };