diff --git a/src/service/auth.ts b/src/service/auth.ts index 7223255..a0d5fbd 100644 --- a/src/service/auth.ts +++ b/src/service/auth.ts @@ -62,8 +62,8 @@ export const apiResetPassword = async (payload: ResetPasswordPayload) => { return response.data; }; -export const apiGetCurrentUser = async () => { - const response = await api.get(API.User.CURRENT); +export const apiGetCurrentUser = async (config?: any) => { + const response = await api.get(API.User.CURRENT, config); return response?.data; }; diff --git a/src/uhm/components/preview/PreviewMapShell.tsx b/src/uhm/components/preview/PreviewMapShell.tsx index 13ecbc5..3b7b2d8 100644 --- a/src/uhm/components/preview/PreviewMapShell.tsx +++ b/src/uhm/components/preview/PreviewMapShell.tsx @@ -121,7 +121,7 @@ export default function PreviewMapShell({ useEffect(() => { const fetchUserAvatar = async () => { try { - const userData = await apiGetCurrentUser(); + const userData = await apiGetCurrentUser({ skipRefresh: true } as any); console.log("PreviewMapShell: Fetched userData:", userData); if (userData?.data?.profile?.avatar_url) { console.log("PreviewMapShell: Setting avatarUrl to:", userData.data.profile.avatar_url); @@ -130,7 +130,7 @@ export default function PreviewMapShell({ console.log("PreviewMapShell: No avatar_url in profile:", userData?.data?.profile); } } catch (err) { - console.error("PreviewMapShell: Failed to fetch user avatar:", err); + console.log("PreviewMapShell: No active session (user is guest)"); } }; fetchUserAvatar(); @@ -250,17 +250,34 @@ export default function PreviewMapShell({ padding: 0, }} > - Cài đặt + {avatarUrl ? ( + Cài đặt + ) : ( + + + + + )} {isMenuOpen && (