Skip to content

Commit 308b036

Browse files
authored
[커뮤니티] 프로필 페이지 SSR 전환 및 에러 리다이렉트 처리
[커뮤니티] 프로필 페이지 SSR 전환 및 에러 리다이렉트 처리
2 parents aa79112 + b787ec9 commit 308b036

File tree

2 files changed

+31
-52
lines changed

2 files changed

+31
-52
lines changed
Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1-
import { Suspense } from 'react'
2-
import LoadingSpinner from '@/components/ui/LoadingSpinner'
3-
import MembersContent from '@/app/(header-layout)/profile/components/MembersContent'
4-
5-
export default function MemberProfilePage() {
6-
return (
7-
<Suspense fallback={<LoadingSpinner />}>
8-
<MembersContent />
9-
</Suspense>
10-
)
1+
import { redirect } from 'next/navigation'
2+
import { getMemberById } from '@/services/member'
3+
import ProfileSection from '@/app/(header-layout)/profile/components/profile/ProfileSection'
4+
import MemberInfoSection from '@/app/(header-layout)/profile/components/memberinfo/MemberInfoSection'
5+
6+
type PageParams = Promise<{ memberId: string }>
7+
8+
export default async function MemberProfilePage({ params }: { params: PageParams }) {
9+
const { memberId } = await params
10+
const id = Number(memberId)
11+
12+
if (isNaN(id)) {
13+
redirect('/error')
14+
}
15+
16+
try {
17+
const data = await getMemberById(id)
18+
19+
if (!data?.member) {
20+
redirect('/error')
21+
}
22+
23+
return (
24+
<div className="flex flex-col gap-6">
25+
<ProfileSection user={data.member} />
26+
<MemberInfoSection user={data.member} />
27+
</div>
28+
)
29+
} catch {
30+
redirect('/error')
31+
}
1132
}

src/app/(header-layout)/profile/components/MembersContent.tsx

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)