-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from INtiful/refactor/go/KAN-117-mypage
refactor: mypage 리팩토링
- Loading branch information
Showing
14 changed files
with
202 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use client'; | ||
|
||
import Loader from '@/app/components/Loader/Loader'; | ||
|
||
const Loading = () => { | ||
return ( | ||
<div className='flex min-h-360 items-center justify-center'> | ||
<Loader />; | ||
</div> | ||
); | ||
}; | ||
|
||
export default Loading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import { Metadata } from 'next'; | ||
import MyGatheringList from './_component/MyGatheringList'; | ||
import getMyGatherings from '@/app/api/actions/gatherings/getMyGatherings'; | ||
import { getUserData } from '@/app/api/actions/mypage/getUserData'; | ||
|
||
export const metadata: Metadata = { | ||
title: '나의 모임 | Soothe With Me', | ||
description: 'Soothe With Me 나의 모임 페이지입니다.', | ||
}; | ||
|
||
const Mygatherings = () => { | ||
return <MyGatheringList />; | ||
const Mygatherings = async () => { | ||
const myGatherings = await getMyGatherings(); | ||
const user = await getUserData(); | ||
return <MyGatheringList initData={myGatherings} user={user} />; | ||
}; | ||
|
||
export default Mygatherings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use server'; | ||
|
||
import { getCookie } from '@/actions/auth/cookie/cookie'; | ||
import { GatheringType } from '@/types/data.type'; | ||
|
||
const getMyGatherings = async () => { | ||
const token = await getCookie('token'); | ||
try { | ||
const res = await fetch( | ||
`${process.env.NEXT_PUBLIC_API_BASE_URL}/gatherings/joined?limit=10&offset=0`, | ||
{ | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}, | ||
); | ||
|
||
if (!res.ok) { | ||
throw new Error('모임을 불러오지 못했습니다.'); | ||
} | ||
|
||
const data: GatheringType[] = await res.json(); | ||
|
||
return data; | ||
} catch (error) { | ||
throw new Error( | ||
error instanceof Error ? error.message : '모임을 불러오지 못했습니다.', | ||
); | ||
} | ||
}; | ||
|
||
export default getMyGatherings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.