-
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 #147 from themoment-team/develop
Release v1.5.1
- Loading branch information
Showing
34 changed files
with
483 additions
and
120 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,31 @@ | ||
import { cookies } from 'next/headers'; | ||
import { redirect } from 'next/navigation'; | ||
|
||
import { boardUrl } from '@/libs'; | ||
import type { BoardInfoType } from '@/types'; | ||
|
||
export const getBoardList = async (): Promise<BoardInfoType[]> => { | ||
const accessToken = cookies().get('accessToken')?.value; | ||
|
||
if (!accessToken) return redirect('/auth/refresh'); | ||
|
||
const response = await fetch( | ||
new URL(`/api/v1${boardUrl.getBoardList(0)}`, process.env.BASE_URL), | ||
{ | ||
method: 'GET', | ||
headers: { Cookie: `accessToken=${accessToken}` }, | ||
} | ||
); | ||
|
||
if (response.status === 401) { | ||
return redirect('/auth/refresh'); | ||
} | ||
|
||
if (!response.ok) { | ||
return redirect('/auth/signin'); | ||
} | ||
|
||
const boardList: BoardInfoType[] = await response.json(); | ||
|
||
return boardList; | ||
}; |
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,2 +1,3 @@ | ||
export * from './comment'; | ||
export * from './getBoardDetail'; | ||
export * from './getBoardList'; |
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,3 +1,4 @@ | ||
export * from './board'; | ||
export * from './mentee'; | ||
export * from './mentor'; | ||
export * from './teacher'; |
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,37 @@ | ||
import { cookies } from 'next/headers'; | ||
import { redirect } from 'next/navigation'; | ||
|
||
import { userUrl } from '@/libs'; | ||
|
||
export const getIsTeacher = async ( | ||
redirectUrl: string | ||
): Promise<boolean | null> => { | ||
const accessToken = cookies().get('accessToken')?.value; | ||
|
||
if (!accessToken) return redirect(`/auth/refresh?redirect=${redirectUrl}`); | ||
|
||
const response = await fetch( | ||
new URL(`/api/v1${userUrl.isTeacher()}`, process.env.BASE_URL), | ||
{ | ||
method: 'GET', | ||
headers: { | ||
Cookie: `accessToken=${accessToken}`, | ||
}, | ||
} | ||
); | ||
|
||
if (response.status === 403) { | ||
return null; | ||
} | ||
|
||
if (response.status === 401) { | ||
return redirect(`/auth/refresh?redirect=${redirectUrl}`); | ||
} | ||
|
||
if (!response.ok) { | ||
return redirect('/auth/signin'); | ||
} | ||
const isTeacher = await response.json(); | ||
|
||
return isTeacher?.isTeacher; | ||
}; |
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 @@ | ||
export * from './getIsTeacher'; |
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,21 @@ | ||
import { getBoardList } from '@/apis'; | ||
import { TeacherBoard } from '@/pageContainer'; | ||
|
||
import type { Metadata } from 'next'; | ||
|
||
export const metadata: Metadata = { | ||
title: '선생님 게시판', | ||
description: '게시판 페이지입니다.', | ||
openGraph: { | ||
title: '게시판', | ||
description: '게시판 페이지입니다.', | ||
}, | ||
}; | ||
|
||
const TeacherBoardPage = async () => { | ||
const boardList = await getBoardList(); | ||
|
||
return <TeacherBoard initialData={[...boardList]} />; | ||
}; | ||
|
||
export default TeacherBoardPage; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const NoticeIcon = () => ( | ||
<svg | ||
width='1.5625rem' | ||
height='1.5625rem' | ||
viewBox='0 0 25 25' | ||
fill='none' | ||
xmlns='http://www.w3.org/2000/svg' | ||
> | ||
<path | ||
d='M3.16699 13.5L8.99662 14L9.89316 20.4817C10.012 21.3412 9.47231 22.1547 8.63422 22.3793C7.81179 22.5997 6.95188 22.1853 6.61173 21.4048L3.16699 13.5Z' | ||
fill='#B4B5B7' | ||
/> | ||
<path | ||
d='M9.66699 6.5C9.66699 6.5 12.167 6.41176 14.667 5.29412C15.5737 4.88878 16.4803 4.40995 17.2677 3.96424C18.3119 3.37318 19.667 4.11204 19.667 5.31193V18.2854C19.667 19.5592 18.1322 20.3121 17.0693 19.6102C16.3765 19.1526 15.5667 18.6498 14.667 18.1471C11.667 16.4706 9.66699 16.5 9.66699 16.5V6.5Z' | ||
fill='#B4B5B7' | ||
/> | ||
<path | ||
d='M2.66699 11.5C2.66699 8.73858 4.90557 6.5 7.66699 6.5H9.66699V16.5H7.66699C4.90557 16.5 2.66699 14.2614 2.66699 11.5Z' | ||
fill='#D8D9DA' | ||
/> | ||
<path | ||
d='M22.667 12C22.667 10.3431 21.3238 9 19.667 9V15C21.3238 15 22.667 13.6569 22.667 12Z' | ||
fill='#D8D9DA' | ||
/> | ||
</svg> | ||
); | ||
|
||
export default NoticeIcon; |
Oops, something went wrong.