2026-02-05 00:46:55 +00:00
|
|
|
import { GET_LOGIC_FUNCTION_SOURCE_CODE } from '@/logic-functions/graphql/queries/getLogicFunctionSourceCode';
|
2026-03-13 13:59:46 +00:00
|
|
|
import { useQuery } from '@apollo/client/react';
|
2026-02-05 00:46:55 +00:00
|
|
|
import {
|
|
|
|
|
type GetLogicFunctionSourceCodeQuery,
|
|
|
|
|
type GetLogicFunctionSourceCodeQueryVariables,
|
|
|
|
|
} from '~/generated-metadata/graphql';
|
|
|
|
|
|
|
|
|
|
export const useGetLogicFunctionSourceCode = ({
|
|
|
|
|
logicFunctionId,
|
|
|
|
|
}: {
|
|
|
|
|
logicFunctionId: string;
|
2026-02-12 10:40:49 +00:00
|
|
|
}) => {
|
2026-02-05 00:46:55 +00:00
|
|
|
const { data, loading } = useQuery<
|
|
|
|
|
GetLogicFunctionSourceCodeQuery,
|
|
|
|
|
GetLogicFunctionSourceCodeQueryVariables
|
|
|
|
|
>(GET_LOGIC_FUNCTION_SOURCE_CODE, {
|
|
|
|
|
variables: {
|
|
|
|
|
input: { id: logicFunctionId },
|
|
|
|
|
},
|
|
|
|
|
skip: !logicFunctionId,
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-16 09:43:29 +00:00
|
|
|
return { sourceHandlerCode: data?.getLogicFunctionSourceCode, loading };
|
2026-02-05 00:46:55 +00:00
|
|
|
};
|