### What problem does this PR solve? Feat: Import dsl from agent list page #9869 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
17 lines
521 B
TypeScript
17 lines
521 B
TypeScript
import { useFetchAgent } from '@/hooks/use-agent-request';
|
|
import { downloadJsonFile } from '@/utils/file-util';
|
|
import { useCallback } from 'react';
|
|
import { useBuildDslData } from './use-build-dsl';
|
|
|
|
export const useHandleExportJsonFile = () => {
|
|
const { buildDslData } = useBuildDslData();
|
|
const { data } = useFetchAgent();
|
|
|
|
const handleExportJson = useCallback(() => {
|
|
downloadJsonFile(buildDslData().graph, `${data.title}.json`);
|
|
}, [buildDslData, data.title]);
|
|
|
|
return {
|
|
handleExportJson,
|
|
};
|
|
};
|