From 92f3bebede24c33e2aa7fc1136b8c6fa2a6d71ef Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Sun, 17 Dec 2023 14:15:52 +0100 Subject: [PATCH] fix profile display --- client/src/Profile.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/client/src/Profile.tsx b/client/src/Profile.tsx index 56ff84d..25a56b4 100644 --- a/client/src/Profile.tsx +++ b/client/src/Profile.tsx @@ -19,11 +19,19 @@ export function Profile({ self }: IProfileProps) { return
Error
; } + const { posts } = loaderData; + + const user = self ? homeContext.user : loaderData.user; + + if (!user || isError(user)) { + return
Error
; + } + return (
- {homeContext.user.fullName} - {homeContext.user.fullName} + {user.fullName} + {user.username}
{self && (
@@ -38,10 +46,7 @@ export function Profile({ self }: IProfileProps) {
)} - +
); }