fix: dsl check

This commit is contained in:
StyleZhang
2024-11-27 14:30:47 +08:00
parent e908ecab8f
commit e145dba487
7 changed files with 43 additions and 49 deletions

View File

@ -24,7 +24,6 @@ import {
useQuery,
useQueryClient,
} from '@tanstack/react-query'
import { useStore as usePluginDependencyStore } from '@/app/components/workflow/plugin-dependency/store'
import { useInvalidateAllBuiltInTools } from './use-tools'
const NAME_SPACE = 'plugins'
@ -324,36 +323,6 @@ export const useMutationClearAllTaskPlugin = () => {
})
}
export const useMutationCheckDependenciesBeforeImportDSL = () => {
const mutation = useMutation({
mutationFn: ({ dslString, url }: { dslString?: string, url?: string }) => {
if (url) {
return post<{ leaked: Dependency[] }>(
'/apps/import/url/dependencies/check',
{
body: {
url,
},
},
)
}
return post<{ leaked: Dependency[] }>(
'/apps/import/dependencies/check',
{
body: {
data: dslString,
},
})
},
onSuccess: (data) => {
const { setDependencies } = usePluginDependencyStore.getState()
setDependencies(data.leaked || [])
},
})
return mutation
}
export const useDownloadPlugin = (info: { organization: string; pluginName: string; version: string }, needDownload: boolean) => {
return useQuery({
queryKey: [NAME_SPACE, 'downloadPlugin', info],