Skip to content

Conversation

@ParkSohyunee
Copy link
Contributor

개요

  • 어드민 페이지의 로그인 기능을 구현했습니다.

작업 사항

  • 어드민 로그인 페이지 퍼블리싱
  • 어드민 로그인 기능
  • 어드민 관련 API 요청시 헤더에 JWT 토큰 추가 (인증)
  • refreshToken으로 accessToken 재발급 받는 로직 추가
  • 어드민 로그아웃 기능
  • 토큰 오류 시 로그인페이지로 리다이렉트

참고 사항 (optional)

  • 어드민 로그인 플로우는 디스코드로 공유드리겠습니다.
  • 추후 비밀번호 변경 기능 추가 예정입니다.

리뷰어에게

  • 확인 부탁드립니다~!! ✨

@vercel
Copy link

vercel bot commented Jan 21, 2025

@ParkSohyunee is attempting to deploy a commit to the Eujin Ahn's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@seoyoung-min seoyoung-min left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

소현님 확인이 늦었습니다! 어드민이 어려운 과제였을텐데, 기능들부터 이렇게 로그인까지 구현해 주셔서 너무 감사합니다 :) 이제는 AT, RT 너무 잘 아시는 소현님 ˃̵͈̑ᴗ˂̵͈̑ 👍👍

Comment on lines +25 to +39
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);
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이제는 로그인의 달인이 되신 소현님...!!

<form onSubmit={handleSubmit(onSubmit)} className={styles.form}>
<div className={styles.field}>
<label htmlFor="account" className={styles.label}>
🐳 아이디
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳🤍


if (error.response?.status === 401 && error.response?.data.error === 'UNAUTHORIZED') {
if (!isRefreshing && refreshToken === undefined) {
// accessToken 만료되었는데, refreshToken 없는 경우, storage 비우기
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주석들 덕분에 이해하기 편했습니다! 👍

@ParkSohyunee ParkSohyunee merged commit e663b2a into 8-Sprinters:dev Jan 27, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Design UI 수정 Feat 구현

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants