8191 command k workflow trigger for selected record (#8315)
Closes #8191 https://github.com/user-attachments/assets/694da229-cc91-4df2-97a0-49cd5dabcf12
This commit is contained in:
@ -0,0 +1,28 @@
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { RUN_WORKFLOW_VERSION } from '@/workflow/graphql/mutations/runWorkflowVersion';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import {
|
||||
RunWorkflowVersionMutation,
|
||||
RunWorkflowVersionMutationVariables,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
export const useRunWorkflowVersion = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const [mutate] = useMutation<
|
||||
RunWorkflowVersionMutation,
|
||||
RunWorkflowVersionMutationVariables
|
||||
>(RUN_WORKFLOW_VERSION, {
|
||||
client: apolloMetadataClient,
|
||||
});
|
||||
|
||||
const runWorkflowVersion = async (
|
||||
workflowVersionId: string,
|
||||
payload: Record<string, any>,
|
||||
) => {
|
||||
await mutate({
|
||||
variables: { input: { workflowVersionId, payload } },
|
||||
});
|
||||
};
|
||||
|
||||
return { runWorkflowVersion };
|
||||
};
|
||||
Reference in New Issue
Block a user