-
Notifications
You must be signed in to change notification settings - Fork 8
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
[FE] 로그인하지 않은 상태에서 페이지에 접근할 때 처리(#551) #552
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c0be45d
feat: public 라우터와 private 라우터 분리
chlwlstlf fbdd8d4
design: 곰돌이 페이지 스타일 통일
chlwlstlf 9bb5f5c
refactor: 주석 제거
chlwlstlf cc2ea56
feat: 홈 화면 바로가기 버튼 추가
chlwlstlf 9b7c540
fix: 뒤로 갔을 때 callback 페이지로 못 가게 변경
chlwlstlf aec2215
feat: 존재하지 않는 페이지 접근 시 404 페이지가 보이도록 추가
pp449 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as S from "./PrivateRoute.style"; | ||
import { useNavigate } from "react-router-dom"; | ||
import Button from "@/components/common/button/Button"; | ||
import { errorCharacter } from "@/assets"; | ||
|
||
const NotFoundRoute = () => { | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<S.PrivateRouteContainer> | ||
<img src={errorCharacter} alt="로그인 후 이용해주세요" /> | ||
<p>해당 페이지를 찾을 수 없습니다.</p> | ||
<Button onClick={() => navigate("/")}>홈 화면으로 가기</Button> | ||
</S.PrivateRouteContainer> | ||
); | ||
}; | ||
|
||
export default NotFoundRoute; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import styled from "styled-components"; | ||
|
||
export const PrivateRouteContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 2rem; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
margin-top: 20%; | ||
|
||
img { | ||
width: 50%; | ||
max-width: 250px; | ||
} | ||
|
||
p { | ||
font: ${({ theme }) => theme.TEXT.medium_bold}; | ||
} | ||
`; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Button from "../common/button/Button"; | ||
import { Outlet, useNavigate } from "react-router-dom"; | ||
import * as S from "@/components/routes/PrivateRoute.style"; | ||
import { errorCharacter } from "@/assets"; | ||
|
||
const PrivateRoute = () => { | ||
const navigate = useNavigate(); | ||
const isLoggedIn = !!localStorage.getItem("accessToken"); | ||
|
||
if (isLoggedIn) { | ||
return <Outlet />; | ||
} | ||
|
||
return ( | ||
<S.PrivateRouteContainer> | ||
<img src={errorCharacter} alt="로그인 후 이용해주세요" /> | ||
<p>로그인 후 이용 가능한 페이지입니다.</p> | ||
<Button onClick={() => navigate("/")}>홈 화면으로 가기</Button> | ||
</S.PrivateRouteContainer> | ||
); | ||
}; | ||
|
||
export default PrivateRoute; |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로그인 상태에 따라 보여주는 거 좋은 것 같네용
다르 의견처럼 존재하지 않는 페이지 접근도 다른 이슈에서 처리해주면 좋을 것 같아요~~