From 8052754a4bcc3d07208d11aad764d2bb3492166d Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 5 Nov 2025 15:52:09 -0800 Subject: add profile page to navbar --- frontend/src/pages/Profile.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'frontend/src/pages') diff --git a/frontend/src/pages/Profile.tsx b/frontend/src/pages/Profile.tsx index 83aa701..8a78fcf 100644 --- a/frontend/src/pages/Profile.tsx +++ b/frontend/src/pages/Profile.tsx @@ -30,7 +30,7 @@ interface UserData { const Profile = () => { const { user, isLoading, logout } = useAuth(); - const targetUser = + let targetUser = new URLSearchParams(window.location.search).get("userId") || ""; // looking at profile of this user const navigate = useNavigate(); const [fetchingHeatmapData, setFetchingHeatmapData] = useState(true); @@ -101,14 +101,15 @@ const Profile = () => { } }, [targetUser]); - if (!targetUser) { - navigate("/"); - } - if (!user) { return ; } + if (!targetUser) { + targetUser = user.id.toString(); + } + + if (isLoading || fetchingHeatmapData || fetchingUserData) { return ; } @@ -129,7 +130,7 @@ const Profile = () => { return (
- + {/* Main Content */}
-- cgit v1.2.3