From 9ca89209af21732fcf950a34d189b8a38e7fc1ae Mon Sep 17 00:00:00 2001 From: MT-Fire <798521692@qq.com> Date: Mon, 9 Mar 2026 16:45:01 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E4=BF=AE=E5=A4=8D=E6=97=B6=E5=BA=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=AF=BC=E8=87=B4=E7=9A=84=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E5=88=97=E8=A1=A8=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/conversationApi.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/services/conversationApi.ts b/src/services/conversationApi.ts index 9ac3aca..ec9e6e6 100644 --- a/src/services/conversationApi.ts +++ b/src/services/conversationApi.ts @@ -115,6 +115,23 @@ export const conversationApi = { */ async fetchConversations(): Promise { const authStore = useAuthStore(); + // 等待 authStore 初始化完成 + if (!authStore.isInitialized) { + await new Promise((resolve) => { + const unwatch = authStore.$subscribe(() => { + if (authStore.isInitialized) { + unwatch(); + resolve(); + } + }); + // 如果已经初始化了,立即 resolve + if (authStore.isInitialized) { + unwatch(); + resolve(); + } + }); + } + const userId = authStore.userId; // 构建 URL,添加 user_id 查询参数