-
Notifications
You must be signed in to change notification settings - Fork 6
Feat: 어드민페이지 로그인 기능 구현 #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ParkSohyunee
merged 6 commits into
8-Sprinters:dev
from
ParkSohyunee:feature/admin-login
Jan 27, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d8f41fb
design: 어드민 페이지 퍼블리싱
ParkSohyunee 211a0d5
Feat: 어드민 로그인페이지 퍼블리싱 및 로그인 기능 구현
ParkSohyunee 1221f5c
Feat: 어드민 관련 기능 어드민 JWT 토큰으로 axiosInstance 적용
ParkSohyunee cb1d6ab
Feat: 로그아웃 기능 구현
ParkSohyunee 3796a30
Feat: accessToken 만료 시, refreshToken으로 토큰 재발급 받는 로직 구현
ParkSohyunee 394d4e0
Feat: API 요청 시 AT, RT 오류일 때 로그인 페이지로 리다이렉트
ParkSohyunee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,7 +1,7 @@ | ||
| import axiosInstance from '@/lib/axios/axiosInstance'; | ||
| import axiosInstanceForAdmin from '@/lib/axios/axiosInstanceForAdmin'; | ||
|
|
||
| const deleteNotice = async (noticeId: number) => { | ||
| await axiosInstance.delete(`/admin/notices/${noticeId}`); | ||
| await axiosInstanceForAdmin.delete(`/admin/notices/${noticeId}`); | ||
| }; | ||
|
|
||
| export default deleteNotice; |
This file contains hidden or 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 hidden or 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,7 +1,7 @@ | ||
| import axiosInstance from '@/lib/axios/axiosInstance'; | ||
| import axiosInstanceForAdmin from '@/lib/axios/axiosInstanceForAdmin'; | ||
|
|
||
| const sendNoticeAlarm = async (noticeId: number) => { | ||
| await axiosInstance.post(`/admin/notices/${noticeId}/alarm`); | ||
| await axiosInstanceForAdmin.post(`/admin/notices/${noticeId}/alarm`); | ||
| }; | ||
|
|
||
| export default sendNoticeAlarm; |
This file contains hidden or 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 hidden or 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,7 +1,7 @@ | ||
| import axiosInstance from '@/lib/axios/axiosInstance'; | ||
| import axiosInstanceForAdmin from '@/lib/axios/axiosInstanceForAdmin'; | ||
|
|
||
| const updateNoticePublic = async (noticeId: number) => { | ||
| await axiosInstance.patch(`/admin/notices/${noticeId}`); | ||
| await axiosInstanceForAdmin.patch(`/admin/notices/${noticeId}`); | ||
| }; | ||
|
|
||
| export default updateNoticePublic; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,62 @@ | ||
| 'use client'; | ||
|
|
||
| import { useRouter } from 'next/navigation'; | ||
| import { useForm } from 'react-hook-form'; | ||
|
|
||
| import * as styles from './pgae.css'; | ||
|
|
||
| import axiosInstance from '@/lib/axios/axiosInstance'; | ||
| import { setCookie } from '@/lib/utils/cookie'; | ||
|
|
||
| interface FormValuesType { | ||
| account: string; | ||
| password: string; | ||
| } | ||
|
|
||
| export default function AdminLogin() { | ||
| const router = useRouter(); | ||
| const { register, handleSubmit } = useForm<FormValuesType>({ | ||
| defaultValues: { | ||
| account: '', | ||
| password: '', | ||
| }, | ||
| }); | ||
|
|
||
| const onSubmit = async (values: FormValuesType) => { | ||
| try { | ||
| const { data } = await axiosInstance.post('/admin/login', values); | ||
|
|
||
| const adminAccessToken = data.accessToken; | ||
| const adminRefreshToken = data.refreshToken; | ||
|
|
||
| setCookie('admin-accessToken', adminAccessToken, 'AT'); | ||
| setCookie('admin-refreshToken', adminRefreshToken, 'ADMIN'); | ||
|
|
||
| router.push('/admin/topics'); | ||
| } catch (error) { | ||
| console.log(error); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <div className={styles.page}> | ||
| <form onSubmit={handleSubmit(onSubmit)} className={styles.form}> | ||
| <div className={styles.field}> | ||
| <label htmlFor="account" className={styles.label}> | ||
| 🐳 아이디 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🐳🤍 |
||
| </label> | ||
| <input id="account" required {...register('account')} className={styles.input} /> | ||
| </div> | ||
| <div className={styles.field}> | ||
| <label htmlFor="password" className={styles.label}> | ||
| 🍀 비밀번호 | ||
| </label> | ||
| <input type="password" id="password" required {...register('password')} className={styles.input} /> | ||
| </div> | ||
| <button type="submit" className={styles.button}> | ||
| 로그인 | ||
| </button> | ||
| </form> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or 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,67 @@ | ||
| import { style } from '@vanilla-extract/css'; | ||
|
|
||
| import { vars } from '@/styles/theme.css'; | ||
| import { BodyRegular } from '@/styles/font.css'; | ||
|
|
||
| export const page = style({ | ||
| width: '100%', | ||
| minHeight: '100vh', | ||
|
|
||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| }); | ||
|
|
||
| export const form = style({ | ||
| padding: '2rem', | ||
|
|
||
| width: '100%', | ||
| maxWidth: '640px', | ||
|
|
||
| display: 'flex', | ||
| gap: '2.5rem', | ||
| flexDirection: 'column', | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| }); | ||
|
|
||
| export const field = style({ | ||
| width: '100%', | ||
|
|
||
| display: 'flex', | ||
| gap: '1rem', | ||
| flexDirection: 'column', | ||
| }); | ||
|
|
||
| export const label = style({ | ||
| fontSize: '2rem', | ||
| fontWeight: 500, | ||
| }); | ||
|
|
||
| export const input = style([ | ||
| BodyRegular, | ||
| { | ||
| padding: '1.2rem 2.4rem', | ||
| borderRadius: '0.8rem', | ||
| border: `1px solid ${vars.color.lightblue}`, | ||
|
|
||
| selectors: { | ||
| '&:focus': { | ||
| border: `1px solid ${vars.color.blue}`, | ||
| }, | ||
| }, | ||
| }, | ||
| ]); | ||
|
|
||
| export const button = style({ | ||
| width: '100%', | ||
| padding: '1.5rem', | ||
| marginTop: '3rem', | ||
|
|
||
| fontSize: '2rem', | ||
| fontWeight: 500, | ||
|
|
||
| borderRadius: '0.8rem', | ||
| backgroundColor: vars.color.blue, | ||
| color: vars.color.white, | ||
| }); |
This file contains hidden or 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,14 @@ | ||
| import Link from 'next/link'; | ||
|
|
||
| import * as styles from './layout.css'; | ||
| import Image from 'next/image'; | ||
|
|
||
| export default function AdminPage() { | ||
| return ( | ||
| <div className={styles.page}> | ||
| <Link href={`${process.env.NEXT_PUBLIC_SERVER_DOMAIN}/admin`}> | ||
| <Image alt="관리자페이지 로고" src="/icons/ver3/logo_ver3.0.png" width={200} height={170} /> | ||
| </Link> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이제는 로그인의 달인이 되신 소현님...!!