diff --git a/.DS_Store b/.DS_Store index 9ef2c6d..de14da2 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/frontend/src/components/UserAuth.tsx b/frontend/src/components/UserAuth.tsx index 782170d..7ff2394 100644 --- a/frontend/src/components/UserAuth.tsx +++ b/frontend/src/components/UserAuth.tsx @@ -27,8 +27,7 @@ export function UserAuth({ user, onOpenAuth, onLogout, onNavigateToAdmin }: User // Helper to get full avatar URL const getAvatarUrl = () => { if (!user?.avatar_url) return null; - const rootUrl = API_BASE_URL.replace('/api', ''); - return `${rootUrl}/upload/${user.avatar_url}`; + return `/upload/${user.avatar_url}`; }; return ( diff --git a/frontend/src/pages/admin/AdminLayout.tsx b/frontend/src/pages/admin/AdminLayout.tsx index 572d0f5..6023a04 100644 --- a/frontend/src/pages/admin/AdminLayout.tsx +++ b/frontend/src/pages/admin/AdminLayout.tsx @@ -66,8 +66,7 @@ export function AdminLayout() { // Helper to get full avatar URL const getAvatarUrl = () => { if (!user?.avatar_url) return null; - const rootUrl = API_BASE_URL.replace('/api', ''); - return `${rootUrl}/upload/${user.avatar_url}`; + return `/upload/${user.avatar_url}`; }; // Load menus from backend diff --git a/frontend/src/pages/admin/UserProfile.tsx b/frontend/src/pages/admin/UserProfile.tsx index 6c211c3..22000ee 100644 --- a/frontend/src/pages/admin/UserProfile.tsx +++ b/frontend/src/pages/admin/UserProfile.tsx @@ -88,10 +88,9 @@ export function UserProfile() { // Construct full avatar URL const getAvatarUrl = () => { if (!userProfile?.avatar_url) return null; + // Use relative path to allow proxying (Vite/Nginx) // The backend returns a relative path like "user/1/avatar/avatar.png" - // The upload directory is mounted at /upload - const rootUrl = API_BASE_URL.replace('/api', ''); - return `${rootUrl}/upload/${userProfile.avatar_url}?t=${new Date().getTime()}`; + return `/upload/${userProfile.avatar_url}?t=${new Date().getTime()}`; }; return (