Просмотр исходного кода

♻️ refactor(files): update react-query syntax to v4 format

- convert useQuery parameters from array syntax to object syntax
- replace array-based query configuration with explicit object properties
- maintain same functionality while improving code readability and compatibility with latest react-query version
yourname 8 месяцев назад
Родитель
Сommit
566ca9c74d
1 измененных файлов с 7 добавлено и 8 удалено
  1. 7 8
      src/client/admin/pages/Files.tsx

+ 7 - 8
src/client/admin/pages/Files.tsx

@@ -20,14 +20,13 @@ const Files: React.FC = () => {
   const queryClient = useQueryClient();
   
   // 获取客户列表
-  const { data: clientsData } = useQuery(
-    ['clients'],
-    () => clientClient.$get({ query: { page: 1, pageSize: 1000 } }) as Promise<InferResponseType<typeof clientClient.$get, 200>>,
-    {
-      onSuccess: (result) => {
-        setClients(result.data);
-      },
-    }
+  const { data: clientsData } = useQuery({
+    queryKey: ['clients'],
+    queryFn: () => clientClient.$get({ query: { page: 1, pageSize: 1000 } }) as Promise<InferResponseType<typeof clientClient.$get, 200>>,
+    onSuccess: (result) => {
+      setClients(result.data);
+    },
+  });
   );
   
   // 获取文件列表数据