fix: update dynamic options fetching to align with API response structure

pull/21425/head
Yeuoly 11 months ago
parent 2e59f0498c
commit fe74f24087

@ -336,7 +336,7 @@ const VarReferencePicker: FC<Props> = ({
setIsLoading(true) setIsLoading(true)
try { try {
const data = await fetchDynamicOptions() const data = await fetchDynamicOptions()
setDynamicOptions(data?.data?.options || []) setDynamicOptions(data?.options || [])
} }
finally { finally {
setIsLoading(false) setIsLoading(false)

@ -478,7 +478,7 @@ export const usePluginTaskList = (category?: PluginType) => {
refreshPluginList(category ? { category } as any : undefined, !category) refreshPluginList(category ? { category } as any : undefined, !category)
} }
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [isRefetching]) }, [isRefetching])
const handleRefetch = useCallback(() => { const handleRefetch = useCallback(() => {
@ -575,7 +575,7 @@ export const usePluginInfo = (providerName?: string) => {
export const useFetchDynamicOptions = (plugin_id: string, provider: string, action: string, parameter: string) => { export const useFetchDynamicOptions = (plugin_id: string, provider: string, action: string, parameter: string) => {
return useMutation({ return useMutation({
mutationFn: () => get<{ data: { options: FormOption[] } }>('/workspaces/current/plugin/parameters/dynamic-options', { mutationFn: () => get<{ options: FormOption[] }>('/workspaces/current/plugin/parameters/dynamic-options', {
params: { params: {
plugin_id, plugin_id,
provider, provider,

Loading…
Cancel
Save