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() {
-
+
>
);