mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-17 13:17:20 +08:00
### What problem does this PR solve? Refactor: UmiJs -> Vite+React ### Type of change - [x] Refactoring --------- Co-authored-by: Liu An <asiro@qq.com>
20 lines
699 B
TypeScript
20 lines
699 B
TypeScript
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
|
import { useRemoveKnowledgeGraph } from '@/hooks/use-knowledge-request';
|
|
import { useCallback } from 'react';
|
|
import { useParams } from 'react-router';
|
|
|
|
export function useDeleteKnowledgeGraph() {
|
|
const { removeKnowledgeGraph, loading } = useRemoveKnowledgeGraph();
|
|
const { navigateToDataset } = useNavigatePage();
|
|
const { id } = useParams();
|
|
|
|
const handleDeleteKnowledgeGraph = useCallback(async () => {
|
|
const ret = await removeKnowledgeGraph();
|
|
if (ret === 0 && id) {
|
|
navigateToDataset(id)();
|
|
}
|
|
}, [id, navigateToDataset, removeKnowledgeGraph]);
|
|
|
|
return { handleDeleteKnowledgeGraph, loading };
|
|
}
|