feat: 修改计费模式为tokens

This commit is contained in:
archer
2023-03-25 14:43:32 +08:00
parent 4eaf3a1be0
commit 6bba859060
18 changed files with 97 additions and 38 deletions

View File

@@ -18,11 +18,15 @@ export const usePaging = <T = any>({
const [total, setTotal] = useState(0);
const [isLoadAll, setIsLoadAll] = useState(false);
const [requesting, setRequesting] = useState(false);
const [initRequesting, setInitRequesting] = useState(false);
const getData = useCallback(
async (num: number, init = false) => {
if (requesting) return;
if (!init && isLoadAll) return;
if (init) {
setInitRequesting(true);
}
setRequesting(true);
try {
@@ -49,6 +53,7 @@ export const usePaging = <T = any>({
}
setRequesting(false);
setInitRequesting(false);
return null;
},
[api, isLoadAll, pageSize, params, requesting, toast]
@@ -66,6 +71,7 @@ export const usePaging = <T = any>({
getData,
requesting,
isLoadAll,
nextPage
nextPage,
initRequesting
};
};