From b823ca3d9f2e6dd6cdc2d388576d02c73d5f9896 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 01 十二月 2025 13:20:45 +0800
Subject: [PATCH] release: @life-payment/core v0.0.4
---
packages/components/src/hooks/index.ts | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/packages/components/src/hooks/index.ts b/packages/components/src/hooks/index.ts
index 624ec3d..8288b45 100644
--- a/packages/components/src/hooks/index.ts
+++ b/packages/components/src/hooks/index.ts
@@ -283,23 +283,25 @@
onSetUserAccount: (currentUserAccount: UserAccountListOutput) => any;
getDefaultUserAccount?: (
userAccountList: UserAccountListOutput[]
- ) => UserAccountListOutput | undefined;
+ ) => Promise<UserAccountListOutput | undefined>;
};
export function useSetUserAccountBySelect({
lifePayOrderType,
onSetUserAccount,
- getDefaultUserAccount = (data) => data[0],
+ getDefaultUserAccount = (data) => Promise.resolve(data[0]),
}: UseSetUserAccountBySelectOptions) {
const { userAccountAllList } = useUserAccountAllList({
lifePayOrderType: lifePayOrderType,
- onSuccess(data) {
- if (data.length > 0) {
- const currentUserAccount = getDefaultUserAccount(data);
- if (currentUserAccount) {
- onSetUserAccount?.(currentUserAccount);
+ async onSuccess(data) {
+ try {
+ if (data.length > 0) {
+ const currentUserAccount = await getDefaultUserAccount(data);
+ if (currentUserAccount) {
+ onSetUserAccount?.(currentUserAccount);
+ }
}
- }
+ } catch (error) {}
},
});
--
Gitblit v1.9.1