### What problem does this PR solve? Fixes: Bugs fixed - Removed invalid code, - Modified the user center style, - Added an automatic data source parsing switch. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
21 lines
532 B
TypeScript
21 lines
532 B
TypeScript
import { useExportMcpServer } from '@/hooks/use-mcp-request';
|
|
import { downloadJsonFile } from '@/utils/file-util';
|
|
import { useCallback } from 'react';
|
|
|
|
export function useExportMcp() {
|
|
const { exportMcpServer } = useExportMcpServer();
|
|
|
|
const handleExportMcpJson = useCallback(
|
|
(ids: string[]) => async () => {
|
|
const data = await exportMcpServer(ids);
|
|
if (data.code === 0) {
|
|
downloadJsonFile(data.data, `mcp.json`);
|
|
}
|
|
},
|
|
[exportMcpServer],
|
|
);
|
|
|
|
return {
|
|
handleExportMcpJson,
|
|
};
|
|
}
|