From 5d668b207868680bc4792123e07055ec73ac411e Mon Sep 17 00:00:00 2001 From: kyuuseiryuu Date: Tue, 10 Feb 2026 16:00:54 +0900 Subject: [PATCH] feat(Profile): uid param --- src/frontend.tsx | 4 +++- src/page/ProfilePage.tsx | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/frontend.tsx b/src/frontend.tsx index 3133a03..920ecb1 100644 --- a/src/frontend.tsx +++ b/src/frontend.tsx @@ -49,7 +49,9 @@ const route = createBrowserRouter([ { path: 'profile/:uid', loader: async ({ params }) => { - return fetch(`/api/user/${params.uid}`); + const { uid } = params; + const profile = await (await fetch(`/api/user/${uid}`)).json(); + return { profile, uid }; }, Component: ProfilePage, HydrateFallback: () => diff --git a/src/page/ProfilePage.tsx b/src/page/ProfilePage.tsx index ce08191..caa1223 100644 --- a/src/page/ProfilePage.tsx +++ b/src/page/ProfilePage.tsx @@ -82,7 +82,7 @@ function PlayerList(props: { title: string; names?: string[]; uids?: string[] }) } export default function ProfilePage() { - const profile = useLoaderData(); + const { profile, uid } = useLoaderData<{ profile: XCXProfile; uid: string }>(); console.debug('profile', profile); const navigate = useNavigate(); useTitle(`${profile?.username}${profile?.realname ? ` (${profile?.realname})` : ''} 个人详情`, { restoreOnUnmount: true }); @@ -106,7 +106,7 @@ export default function ProfilePage() { {profile?.description} - + @@ -131,7 +131,7 @@ export default function ProfilePage() { - + );