We were using metadata client by legacy. Architecture is not great for Core engine: workflows are available both in data and metadata client. It makes more sense to use the data client since workflows are part of standard objects
26 lines
776 B
TypeScript
26 lines
776 B
TypeScript
import { COMPUTE_STEP_OUTPUT_SCHEMA } from '@/workflow/graphql/mutations/computeStepOutputSchema';
|
|
import { useApolloClient, useMutation } from '@apollo/client';
|
|
import {
|
|
ComputeStepOutputSchemaInput,
|
|
ComputeStepOutputSchemaMutation,
|
|
ComputeStepOutputSchemaMutationVariables,
|
|
} from '~/generated/graphql';
|
|
|
|
export const useComputeStepOutputSchema = () => {
|
|
const apolloClient = useApolloClient();
|
|
const [mutate] = useMutation<
|
|
ComputeStepOutputSchemaMutation,
|
|
ComputeStepOutputSchemaMutationVariables
|
|
>(COMPUTE_STEP_OUTPUT_SCHEMA, {
|
|
client: apolloClient,
|
|
});
|
|
|
|
const computeStepOutputSchema = async (
|
|
input: ComputeStepOutputSchemaInput,
|
|
) => {
|
|
return await mutate({ variables: { input } });
|
|
};
|
|
|
|
return { computeStepOutputSchema };
|
|
};
|