File tree Expand file tree Collapse file tree 2 files changed +31
-52
lines changed
Expand file tree Collapse file tree 2 files changed +31
-52
lines changed Original file line number Diff line number Diff line change 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}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments