Unverified Commit 749ba5c1 authored by SUPER_AI's avatar SUPER_AI Committed by GitHub

feat(table): support asynchrony in beforeFetch and afterFetch (#827)

parent d38ff667
...@@ -203,7 +203,7 @@ export function useDataSource( ...@@ -203,7 +203,7 @@ export function useDataSource(
...(opt?.filterInfo ?? {}), ...(opt?.filterInfo ?? {}),
}; };
if (beforeFetch && isFunction(beforeFetch)) { if (beforeFetch && isFunction(beforeFetch)) {
params = beforeFetch(params) || params; params = (await beforeFetch(params)) || params;
} }
const res = await api(params); const res = await api(params);
...@@ -225,7 +225,7 @@ export function useDataSource( ...@@ -225,7 +225,7 @@ export function useDataSource(
} }
if (afterFetch && isFunction(afterFetch)) { if (afterFetch && isFunction(afterFetch)) {
resultItems = afterFetch(resultItems) || resultItems; resultItems = (await afterFetch(resultItems)) || resultItems;
} }
dataSourceRef.value = resultItems; dataSourceRef.value = resultItems;
setPagination({ setPagination({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment