Skip to content

refactor: refactoring go routing nightstudy #66#69

Open
dlskl wants to merge 1 commit intomainfrom
origin/Fix/goRoutingNightStudy/#66
Open

refactor: refactoring go routing nightstudy #66#69
dlskl wants to merge 1 commit intomainfrom
origin/Fix/goRoutingNightStudy/#66

Conversation

@dlskl
Copy link
Member

@dlskl dlskl commented Sep 23, 2025

  • 권한 있는 사용자가 접속 시
    : 접속 가능
  • 권한 없는 사용자가 접속 시
    : nightstudy로 이동

}, []);

if (isDormitoryManageMember === null || !isDormitoryManageMember) {
if (isDormitoryManageMember === null) {
Copy link
Member

Choose a reason for hiding this comment

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

if (!isDormitoryManageMember) {
는 어떨까요

Copy link
Member

Choose a reason for hiding this comment

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

여기에 덧붙여서 isDomitoryManageMember의 값이 null이거나 빈문자열 등등으로 올 때 자바스크립트에서는 falsy라고 판단하여서 !연산자 하나로만 if절을 완성시켜도 될듯 합니다.

그럼 수정된 코드는

if (!isDomitoryManageMember) {
  return <Navigate to "/" replace />
}

가 되는게 맞을 것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

저도 처음에는 !isDormitoryManageMember만으로 조건을 처리했었는데, 로딩 중(null 상태)에도 /nightstudy로 리다이렉트되는 이슈가 있어서 null 체크를 추가해서 로딩 상태를 별도로 처리하게 되었습니다.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants