From fc88907ede10598c1ebdd52f13f2b5db4dd2981e Mon Sep 17 00:00:00 2001 From: Developer Date: Thu, 26 Mar 2026 10:18:48 +0800 Subject: [PATCH] 1 --- app/index.tsx | 1 + store/authStore.ts | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/index.tsx b/app/index.tsx index d98211f..6c50bda 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -523,6 +523,7 @@ const styles = StyleSheet.create({ searchBar: { flex: 1, height: 30, + marginLeft: 8, backgroundColor: "#f0f0f0", borderRadius: 15, flexDirection: "row", diff --git a/store/authStore.ts b/store/authStore.ts index 5fa5769..34629d0 100644 --- a/store/authStore.ts +++ b/store/authStore.ts @@ -25,19 +25,16 @@ export const useAuthStore = create((set) => ({ login: async (sessdata, uid, username) => { await setSecure('SESSDATA', sessdata); // Migrate: remove SESSDATA from AsyncStorage if it was there before - await AsyncStorage.removeItem('SESSDATA').catch(() => {}); + await AsyncStorage.removeItem('SESSDATA').catch(() => { }); set({ sessdata, uid: uid || null, username: username || null, isLoggedIn: true }); - // 延迟 1s 后台拉取头像,避免与登录后立即触发的其他请求(如 getFollowedLiveRooms)并发 - setTimeout(() => { - getUserInfo().then(async (info) => { - await AsyncStorage.multiSet([ - ['UID', String(info.mid)], - ['USERNAME', info.uname], - ['FACE', info.face], - ]).catch(() => {}); - set({ face: info.face, username: info.uname, uid: String(info.mid) }); - }).catch(() => {}); - }, 1000); + getUserInfo().then(async (info) => { + await AsyncStorage.multiSet([ + ['UID', String(info.mid)], + ['USERNAME', info.uname], + ['FACE', info.face], + ]).catch(() => { }); + set({ face: info.face, username: info.uname, uid: String(info.mid) }); + }).catch(() => { }); }, logout: async () => { @@ -63,7 +60,7 @@ export const useAuthStore = create((set) => ({ const info = await getUserInfo(); await AsyncStorage.setItem('FACE', info.face); set({ face: info.face, username: info.uname, uid: String(info.mid) }); - } catch {} + } catch { } } },