Skip to content

Commit

Permalink
feat(table): support asynchrony in beforeFetch and afterFetch (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
init-center authored Jun 29, 2021
1 parent d38ff66 commit 749ba5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Table/src/hooks/useDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export function useDataSource(
...(opt?.filterInfo ?? {}),
};
if (beforeFetch && isFunction(beforeFetch)) {
params = beforeFetch(params) || params;
params = (await beforeFetch(params)) || params;
}

const res = await api(params);
Expand All @@ -225,7 +225,7 @@ export function useDataSource(
}

if (afterFetch && isFunction(afterFetch)) {
resultItems = afterFetch(resultItems) || resultItems;
resultItems = (await afterFetch(resultItems)) || resultItems;
}
dataSourceRef.value = resultItems;
setPagination({
Expand Down

0 comments on commit 749ba5c

Please sign in to comment.