fix: plugins task permission (#13330)

This commit is contained in:
zxhlyh 2025-02-07 16:02:12 +08:00 committed by GitHub
parent a8a8a5513c
commit 7e1d9894fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import {
useQueryClient,
} from '@tanstack/react-query'
import { useInvalidateAllBuiltInTools } from './use-tools'
import usePermission from '@/app/components/plugins/plugin-page/use-permission'
const NAME_SPACE = 'plugins'
@ -356,12 +357,16 @@ export const useFetchPluginsInMarketPlaceByInfo = (infos: Record<string, any>[])
const usePluginTaskListKey = [NAME_SPACE, 'pluginTaskList']
export const usePluginTaskList = () => {
const {
canManagement,
} = usePermission()
const {
data,
isFetched,
refetch,
...rest
} = useQuery({
enabled: canManagement,
queryKey: usePluginTaskListKey,
queryFn: () => get<{ tasks: PluginTask[] }>('/workspaces/current/plugin/tasks?page=1&page_size=100'),
refetchInterval: (lastQuery) => {