[#82] feat: login page 구현#83
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements the login page with OAuth flows and adds an authentication guard for protected routes.
- Introduces a login page styled with styled-system and OAuth links for Google and Kakao
- Updates routing to include
/loginand wraps protected pages underAuthGuard - Adds
useGetIsLoginhook,AuthGuardcomponent, and SVG logo assets
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Removed trailing slash from base path |
| src/pages/routes.tsx | Added /login route and wrapped protected routes with AuthGuard |
| src/pages/LoginPage/style.css.ts | Defined styled-system CSS tokens and variants for login UI |
| src/pages/LoginPage/index.tsx | Login page logic with auth status check and navigation |
| src/libs/assets/GoogleLogo.tsx | Added Google login SVG component |
| src/libs/assets/KakaoLogo.tsx | Added Kakao login SVG component |
| src/common/hooks/apis/useGetIsLogin.ts | Set staleTime: 0 to always revalidate login status |
| src/common/components/AuthGuard/index.tsx | Added AuthGuard to redirect unauthenticated users |
Comments suppressed due to low confidence (3)
src/pages/routes.tsx:6
- [nitpick] The import name 'PostPage' does not match the file name 'PostPages'; rename one for consistency (e.g., import PostPages or rename the file).
import PostPage from './PostPages';
src/common/components/AuthGuard/index.tsx:1
- AuthGuard's redirect and outlet-rendering logic is not covered by any tests; consider adding unit or integration tests to verify both allowed and blocked access flows.
import useGetIsLogin from '@/common/hooks/apis/useGetIsLogin';
src/pages/LoginPage/index.tsx:1
- LoginPage's loading state and redirect behavior lack test coverage; add tests to confirm the UI while loading and the navigate logic when already logged in.
import { useEffect } from 'react';
Comment on lines
+14
to
+18
|
|
||
| useEffect(() => { | ||
| // TODO: 원래 있던 페이지로 | ||
| if (isLogin) { | ||
| navigate(-1); |
There was a problem hiding this comment.
[nitpick] Using navigate(-1) can lead to unexpected navigation loops or unclear fallback targets; consider capturing the original location in state and redirecting there explicitly.
Suggested change
| useEffect(() => { | |
| // TODO: 원래 있던 페이지로 | |
| if (isLogin) { | |
| navigate(-1); | |
| useEffect(() => { | |
| // Store the original location when navigating to the login page | |
| const originalLocation = window.location.pathname; | |
| sessionStorage.setItem('originalLocation', originalLocation); | |
| }, []); | |
| useEffect(() => { | |
| // Redirect to the original location after login | |
| if (isLogin) { | |
| const originalLocation = sessionStorage.getItem('originalLocation') || '/'; | |
| navigate(originalLocation); |
Collaborator
|
좋네요 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
❗ 연관 이슈
📌 내용
☑️ 체크 사항 & 논의 사항
로그인 안되어있는 상태일 때
로그인 되어있는 상태일 때
여전히 카카오 / 구글 리다이렉션 링크가 배포나가있는 url로 되어있어서 로그인 후엔 다시 localhost로 돌아오셔야 합니다
🤔 아직 해야될거 (후속 PR 올릴게연)