Skip to content
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

[FIX] 최초 로그인시 둘러보기 기능 제한 #264

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

1yoouoo
Copy link
Contributor

@1yoouoo 1yoouoo commented Aug 18, 2023

개요 🔍

정책에 따라 최초 로그인시 닉네임 설정을 바로 할 수 있도록 둘러보기 기능을 제한해야해서 미들웨어를 수정했어요

작업사항 📝

#262
close #263

@1yoouoo 1yoouoo added the 🔨 수정 버그 수정 label Aug 18, 2023
@1yoouoo 1yoouoo self-assigned this Aug 18, 2023
Comment on lines -8 to 45
// 비로그인 둘러보기 허용
if (request.nextUrl.pathname === '/archive') {
return NextResponse.next();
// 비로그인
if (!isLoggedIn) {
// 둘러보기 허용
if (request.nextUrl.pathname === '/archive') {
return NextResponse.next();
}
// 로그인 페이지 접근 허용
if (request.nextUrl.pathname === '/login') {
return NextResponse.next();
}
}

if (isLoggedIn) {
// 최초 로그인
if (isLoggedIn && !nickname) {
// 둘러보기 허용
if (request.nextUrl.pathname === '/archive') {
return NextResponse.next();
}
// 닉네임 설정 페이지 허용
if (!nickname && request.nextUrl.pathname === `/settings/profile/nickname`) {
if (request.nextUrl.pathname === `/settings/profile/nickname`) {
return NextResponse.next();
}

// 닉네임 설정 페이지로 이동
if (!nickname) {
return NextResponse.redirect(`${request.nextUrl.origin}/settings/profile/nickname`);
}
return NextResponse.redirect(`${request.nextUrl.origin}/settings/profile/nickname`);
}

// 로그인
if (isLoggedIn) {
// 로그인 페이지 접근 불가
if (request.nextUrl.pathname === '/login') {
return NextResponse.redirect(`${request.nextUrl.origin}/${nickname}`);
}

return NextResponse.next();
}

return NextResponse.redirect(`${request.nextUrl.origin}/login`);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

비로그인, 최초 로그인, 로그인으로 구분지었어요

@1yoouoo 1yoouoo merged commit 4051144 into dev Aug 21, 2023
2 checks passed
@1yoouoo 1yoouoo deleted the fix/middleware-router branch August 21, 2023 07:11
1yoouoo added a commit that referenced this pull request Aug 28, 2023
* refactor: move directory

* refactor: update page router

* feat: create custom tab hook

* design: update introduce layout

* rename: followingList to followerList

* feat: add follower type

* design: update tab height

* feat: fetch follwer list api

* delete: todo.txt

* fix: update routerSlice in loadProfilePage

* chore: update some details

* feat: extract profileImage

* feat: add LinkTo componenet

* feat: add svg chevronRight

* feat: add ProfileCard

* feat: Implement settings page

* feat: add messageToaster

* feat: add&delete svg

* style: add svg and adjust them

* style: set position on bottomNav

* chore: extract component

* fix: watermark & bottom Nav design

* fix: skip Settings.tsx test

* fix: delete BottomNav in MainLayout

* feat: add kakaoButton & logo

* feat: update login page

* fix: update test code

* typo: fix api endpoints

* feat: fetch follower list api

* typo: fix follow api end point

* feat:fetch following api on follower page

* feat: add title props and design header compoent

- 사용자별 닉네임을 헤더에 표시하기 위해 prop 추가

* feat: create full page layout to replace main layout

* feat: init tab state when component is unmounted

* refactor: move header component to common dir

* fix: all api resource nickname to userId

* fix: update type

* chore: add comment

* feat: change params nickname to userId

* fix: change url href

* feat: add selectedTagId in slice

* fix: update userSlice

* feat:fetch following api on follower page

* fix: conflict

* fix: add nickname

* feat: delete modal & add page

* fix: update middleware

* fix: delete some props

* feat: add isEmpty and icon attribute for css

* feat: add loadSetNickname

* fix: change the name of endpoint set-nickname to nickname

* fix: move to common componenet

* [FEAT] 해시태그 컴포넌트 개선 (#242)

* feat: seperate api method

* feat: add baseTag

* feat: add someTag based on baseTag

* feat: add hashtagList

* delete: unused tag, tagList components

* fix: seperate hashtag logic to parent component

* feat: update page's props for changed hashtag component

* chore: update some code

* fix: update favicon

* refactor: move ProfileImage to common dir

* feat: create useTastBar hook

* design: update toastbar style

* fix: import useToastBar hook

* fix: api variant (#246)

* [FIX] 로그인 페이지 디자인 변경 (#244)

* fix: login page's design and add withOutLoginButton

* test: skip login page test

* fix: typo

* [FIX] 헤더 디자인, 기능 개선 + 검색어 (#249)

* feat: improve code of Headers

* fix: update router Slices

* feat: add searchBox

* feat: add some Svg

* feat: add MainTab

* feat: update user Profile image

* [Refactor] link item components (#253)

* refactor: move profileImage to common directory

* temp

* refactor: move button direc

* feat: add svg icon components

* refacor: move LinkItemWithProfile direc

* refactor: move linkItem direc

* refactor: move linkinfo direc

* delte: delete unused file

* fix: css lint

* add: add todo comment

---------

Co-authored-by: 1yoouoo <[email protected]>

* [FEAT] 내 링크가 없을 때 안내 글자 구현 (#260)

* fix: extract bottomNav to layout

* feat: add countSlice and fix typo of hashTagSlice

* feat: add Suggetion.tsx

* feat: add SpeechBubbles.tsx

* feat: add dispatch in feed page

* feat: add svg icon

* style: update position on parent tag

* feat: add totalLinkCount func for counting total link length

* fix: update middleware for first logged in user to surf archive page

* fix: update middleware (#264)

* [FIX] 서비스 배경색 조절을 위한 페이지간 높이 조절 (#266)

* feat: add bottomButton in common folder

* fix: update component's height

* chore: add safe code in taglist

* fix: add linkCount in queryKey

* [Feat] 링크 추가 기능 추가 (#268)

* feat: create text input componente

* feat: update AddTag onKeyDown event prop

* design: update link preview design

* refactor: move common components to create dir

* add: add label icon

* feat: create tag component

* feat: create label component

* feat: add thumbnail size prop

* feat: fetch url meta data with debounced value

* fix: commented interface of TextInputProps for build

---------

Co-authored-by: 1yoouoo <[email protected]>

* fix: update queryClient for invalidateQUeries

* fix: apply mark/unMark at once

* fix: update fetchFn

* Update README.md

* Update README.md

* [Refactor] 링크 추가 컴포넌트 추출 및 버그 해결  (#278)

* feat: create text input componente

* feat: update AddTag onKeyDown event prop

* design: update link preview design

* refactor: move common components to create dir

* add: add label icon

* feat: create tag component

* feat: create label component

* feat: add thumbnail size prop

* feat: fetch url meta data with debounced value

* refactor: extract url inpuit component

* refactor: extract link preview component

* fix: fix hashtag list's limitation to 10

* refactor: move validation function to utils dir

* refactor: extract input component

* fix: fix render condition

* fix: import path

* refactor: create page

* remove: delete not used file

---------

Co-authored-by: dev-hamster <[email protected]>
Co-authored-by: dev-hamster <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 수정 버그 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[fix] 최초 로그인 시 둘러보기 기능 제한
2 participants