-
Notifications
You must be signed in to change notification settings - Fork 2
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] fix: 리뷰 작성 완료 페이지에 url로 직접 접근하는 행위 방지 #866
base: develop
Are you sure you want to change the base?
Conversation
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.
앞으로 리뷰미의 볼륨이 늘어난다 해도 프리하게 접근할 수 있는 작성 페이지 쪽보다는 쿠키 검증을 거치는 리뷰 확인 쪽이 아닐까 싶어요.
작성 관련 페이지들이 늘어난다면 이렇게 접근 경로 체크할 일이 늘어날 수도 있으니 별도의 라우팅 관리 로직을 분리해서 관리하는 게 좋겠지만, 그렇지 않을 것 같아욥
그래서 에프이 구현대로 작성 페이지-작성 완료 페이지에서
간단하게 체크하고 넘어가는 것으로 충분할 것 같습니다~~
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.
홈으로 리다이렉션되는 것에 대한 ux 우려가 있어요. 해당 코멘트 확인 부탁드려요
@@ -8,6 +9,13 @@ import * as S from './styles'; | |||
|
|||
const ReviewWritingCompletePage = () => { | |||
const navigate = useNavigate(); | |||
const location = useLocation(); | |||
|
|||
useEffect(() => { |
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.
제가 유저라면 url로 리뷰 완료 페이지 들어왔을때, 아무런 설명없이 바로 홈으로 리다이렉션이 되면 당황스러울 것 같아요.
저희가 ux를 생각해 오류가 나도 유저가 오류를 스스로 대응할 수 있는 선택권(홈,새로고침버튼)을 주었듯이, 유효하지 않은 리뷰 작성 완료 페이지에 접근하면 해당 접근이 유효하지 않다는 문구와 함께 홈으로 가는 이동 버튼을 제공하면 어떨까 싶어요
@@ -21,7 +21,7 @@ const useSubmitAnswers = ({ closeSubmitConfirmModal }: UseSubmitAnswersProps) => | |||
const navigate = useNavigate(); | |||
|
|||
const executeAfterMutateSuccess = () => { | |||
navigate(`/${ROUTE.reviewWritingComplete}/${reviewRequestCode}`); | |||
navigate(`/${ROUTE.reviewWritingComplete}/${reviewRequestCode}`, { state: { isValidAccess: true } }); |
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.
리뷰 작성 -> 리뷰 작성 완료 -> 리뷰 작성 시에 다시 리뷰 작성 완료 페이지로 문제 없이 갈 수 있는데, 이 부분이 의도된 것인지 궁금해요
_2024_10_17_10_57_15_141.mp4
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.
홈으로 돌아가기 버튼을 누른 경우에는 뒤로가기가 막혀 있는데, 위 영상처럼 이동할 때는 인지하지 못하고 있었네요. 수정해보겠습니다 :)
수정사항1. Breadcrumb 수정
리뷰 작성 완료 페이지
url 직접 접근 막기.webm 여러 상황을 가정하고 테스트 해보았지만 혹시나 추가적인 버그 발견 시 제보 부탁합니다 |
export interface Path { | ||
pageName: string; | ||
path: PathType; | ||
path: string; |
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.
순수 궁금증) 왜 기존 Path 타입에 number도 있었을까요? 지나치면서 궁금했었는데 이제야 질문을...ㅎ
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.
breadcrumb 리팩토링 이전에는 navigate(0), navigate(-1)도 함께 사용되었어요 :0
return ( | ||
<ErrorSection | ||
errorMessage="유효하지 않은 접근이에요" | ||
handleReload={() => navigate(0)} |
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.
유효하지 않은 접근에 새로고침이 필요할까? 싶은 생각이 들었어요. 어차피 유효하지 않은 접근이었다면 아무리 새로고침해도 계속 똑같은 페이지를 보게 될 것이기 때문에...
다른 UI들을 살펴보니 바로 홈으로 리다이렉트시키지는 않지만, 선택지를 홈으로 돌아가기 하나만 주고 있었어요~
|
||
const handleNavigation = (path: PathType) => { | ||
const handleNavigation = (path: string) => { | ||
if (typeof path === 'number') { |
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.
path가 string 타입만 있다면 typeof path === 'number'
는 필요없어지겠네요
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.
현재는 제거된 상태입니다
navigate(path); | ||
} | ||
const handleNavigation = (path: string) => { | ||
navigate(path, { replace: location.pathname.includes(`/${ROUTE.reviewWritingComplete}`) }); |
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.
완료 페이지에서 뒤로가기를 막기 보다, 작성 -> 작성 완료 로 넘어갈 때 주는 state를 작성 완료 페이지 마운트 시useNavigate로 페이지 이동은 하지 않으면서 state:null
로 바꾸는 것은 어떨까요? (pathname이 현재와 같으면 페이지 이동을 하지 않는다고 해요)
작성->작성 완료 -> 작성 에서 다시 이전 으로 돌아기로 작성 완료로 가도 유효하지 않은 접근이라는 것을 보여주고 새로 고침 시에도 유효하지 않은 접근으로 처리할 수 있을 것 같아요
🚀 어떤 기능을 구현했나요 ?
🔥 어떻게 해결했나요 ?
isValidAccess
플래그를 전달합니다. 리뷰 작성 완료 페이지에서는 state가 비어있거나,isValidAccess
가 false일 때 홈페이지로 리다이렉션합니다.📝 어떤 부분에 집중해서 리뷰해야 할까요?
📚 참고 자료, 할 말