diff --git a/src/app/(user)/user/profile/[id]/page.tsx b/src/app/(user)/user/profile/[id]/page.tsx index d4f0b25..bf035a8 100644 --- a/src/app/(user)/user/profile/[id]/page.tsx +++ b/src/app/(user)/user/profile/[id]/page.tsx @@ -156,9 +156,16 @@ export default function AgentProfileView() { } else if (profile.avatar) { setAvatarUrl(profile.avatar); } - } catch (err) { + } catch (err: any) { console.error('Failed to fetch profile:', err); - setError('Failed to load profile data'); + const status = err?.response?.status; + if (status === 403) { + setError('This profile is private. You don\u2019t have permission to view it.'); + } else if (status === 404) { + setError('Profile not found.'); + } else { + setError('Failed to load profile data'); + } } finally { setLoading(false); } @@ -252,23 +259,33 @@ export default function AgentProfileView() { ); } + const isPermissionError = error?.includes('permission') || error?.includes('private'); + if (error || !agentProfile) { return (
-
- - - +
+ {isPermissionError ? ( + + + + ) : ( + + + + )}
-

Unable to Load Profile

+

+ {isPermissionError ? 'Profile Not Available' : 'Unable to Load Profile'} +

{error || 'Profile not found'}