dify/web/app/components/workflow/plugin-dependency/hooks.ts
2024-12-10 14:11:34 +08:00

18 lines
596 B
TypeScript

import { useCallback } from 'react'
import { useStore as usePluginDependenciesStore } from './store'
import { useMutationCheckDependecies } from '@/service/use-plugins'
export const usePluginDependencies = () => {
const { mutateAsync } = useMutationCheckDependecies()
const handleCheckPluginDependencies = useCallback(async (appId: string) => {
const { leaked_dependencies } = await mutateAsync(appId)
const { setDependencies } = usePluginDependenciesStore.getState()
setDependencies(leaked_dependencies)
}, [mutateAsync])
return {
handleCheckPluginDependencies,
}
}