Skip to content

Conversation

@dlcks0601
Copy link
Contributor

#️⃣연관된 이슈

#19

📝작업 내용

  1. 필요없는 타입 삭제 7ad4f9d
  2. redux-persist 의존성 설치 5a6adfa
  3. http.api.ts 토큰 함수 추가 49a3a61
  4. 로그인, 로그아웃 버튼 구현 및 헤더 컴포넌트 추가 2aa6881 8fb9ba9
  5. 인풋 디자인 수정 2d12e1c
  6. redux 상태관리 전면 수정 + persist 추가 e5824cc bd36cd3 0455727 080f372 c5af478

스크린샷 (선택)

  • 로그인 전
    스크린샷 2024-12-17 오전 2 46 56
  • 로그인 후
    스크린샷 2024-12-17 오전 2 53 32
  • 새로고침 후
    스크린샷 2024-12-17 오전 2 54 00

💬리뷰 요구사항(선택)

메인 페이지 와 디자인 작업 속도 보고 마이페이지 이미지 isLoggedIn으로 구현 할 예정

@dlcks0601 dlcks0601 added ✨ Feature 기능 개발 🎨 Html&css 마크업 & 스타일링 📬 API 서버 API 통신 🔨 Refactor 코드 리팩토링 labels Dec 16, 2024
Copy link

@hwookim hwookim left a comment

Choose a reason for hiding this comment

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

안녕하세요 찬님!
유저 로그인 관련 부분을 하시면서 persist도 사용해보시고 여러모로 노력하시는 모습이 보여서 멋집니다. 👍🏼 👍🏼

몇가지 리뷰를 남겨두었으니 한 번 확인해보시면 좋을 것 같아요!

Comment on lines +41 to +45
if (
config.headers &&
'set' in config.headers &&
typeof (config.headers as AxiosHeaders).set === 'function'
) {
Copy link

Choose a reason for hiding this comment

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

Suggested change
if (
config.headers &&
'set' in config.headers &&
typeof (config.headers as AxiosHeaders).set === 'function'
) {
if (typeof config?.headers?.set === 'function') {

이런 식으로 간단하게 표기해볼 수도 있겠네요 🤔

Comment on lines +29 to +43
<LogoutBox onClick={handleLogout}>
<div className='group'>
<div className='overlap-group'>
<div className='text-wrapper'>로그아웃</div>
</div>
</div>
</LogoutBox>
) : (
<LoginBox onClick={handleLogin}>
<div className='group'>
<div className='overlap-group'>
<div className='text-wrapper'>로그인</div>
</div>
</div>
</LoginBox>
Copy link

Choose a reason for hiding this comment

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

LoginButton과 LogoutButton의 두 구조가 완전하게 동일하네요.
중복을 줄이려면 어떻게 하는 게 좋을까요?
styled component에 props를 전달하여 내부에서 스타일을 조정할 수도 있는데, 해당 방식을 사용해보는 건 어때요? 👀

Comment on lines +23 to +29
const response = await axios.post(
'http://localhost:3333/api/users/login',
{
email,
password,
}
);
Copy link

Choose a reason for hiding this comment

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

auth.api.ts에 정의된 내용이 있지는 않았나요 🤔

state.loading = false;
state.error = null;

localStorage.setItem('token', action.payload.token);
Copy link

Choose a reason for hiding this comment

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

지난 번에 드렸던 key의 상수화 리뷰에 덧붙여서,
아예 유저 관리를 위한 localstorage 접근 자체를 유틸함수화해두면 어떨까요?
반복도 줄고, 실수할 일도 더 줄거에요

import { AppDispatch } from '@/store/store';

export interface LoginProps {
type LoginFormData = {
Copy link

Choose a reason for hiding this comment

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

이 타입은 LoginForm이 기준일까요? 아니면 login api의 request body가 기준일까요?
어떤 걸 기준으로 삼냐에 따라 네이밍도, 관리할 위치도 다시 생각해보면 좋을 거 같아요.

Comment on lines +17 to +19
getDefaultMiddleware({
serializableCheck: false, // redux-persist 관련 non-serializable 경고 비활성화
}),
Copy link

Choose a reason for hiding this comment

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

serializableCheck 옵션을 false로 둘 이유가 어떤 이유일까요? 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📬 API 서버 API 통신 ✨ Feature 기능 개발 🎨 Html&css 마크업 & 스타일링 🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants