-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: textarea 추가 Signed-off-by: Jeong-Rae <kkwjdfo@gmail.com> * feat: stage, question 컨테이너 추가 삭제 구현 Signed-off-by: Jeong-Rae <kkwjdfo@gmail.com> * feat: 미들웨어 코드 수정 Signed-off-by: Jeong-Rae <kkwjdfo@gmail.com> * feat: 관리자 페이지 방어기능 추가 Signed-off-by: Jeong-Rae <kkwjdfo@gmail.com> --------- Signed-off-by: Jeong-Rae <kkwjdfo@gmail.com>
- Loading branch information
Showing
5 changed files
with
106 additions
and
38 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
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,5 @@ | ||
export interface BasicResponseDto { | ||
"response": string | ||
"error": string, | ||
"detail": string | ||
} |
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,23 @@ | ||
import {BasicResponseDto} from "@/types/basicResponseDto"; | ||
|
||
const url = process.env.NEXT_PUBLIC_BASE_API; | ||
export const isAdmin = async (accessToken: string) => { | ||
try { | ||
const response = await fetch(`${url}/api/players/me/admin`, { | ||
credentials: "include", | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}); | ||
|
||
if (!response.ok) { | ||
return false; | ||
} | ||
|
||
const body: BasicResponseDto = await response.json(); | ||
|
||
return body.response === "true"; | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
} |