chore: add watch for worker and gpu updating

This commit is contained in:
jialin
2025-05-26 16:17:17 +08:00
parent 9efacefba3
commit 4b4343a9fd
8 changed files with 38 additions and 15 deletions
+12 -8
View File
@@ -7,14 +7,18 @@ import _ from 'lodash';
import qs from 'query-string';
import { useEffect, useRef, useState } from 'react';
export default function useTableFetch<ListItem>(options: {
API?: string;
watch?: boolean;
fetchAPI: (params: any) => Promise<Global.PageResponse<ListItem>>;
deleteAPI?: (id: number, params?: any) => Promise<any>;
contentForDelete?: string;
defaultData?: any[];
}) {
type WatchConfig =
| { watch?: false | undefined; API?: string }
| { watch: true; API: string };
export default function useTableFetch<ListItem>(
options: {
fetchAPI: (params: any) => Promise<Global.PageResponse<ListItem>>;
deleteAPI?: (id: number, params?: any) => Promise<any>;
contentForDelete?: string;
defaultData?: any[];
} & WatchConfig
) {
const {
fetchAPI,
deleteAPI,