Skip to content

[FE] 이벤트 계좌번호 수정을 url로 진입할 경우 에러 발생하는 문제 해결 #866

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

Merged
merged 7 commits into from
Dec 19, 2024

Conversation

jinhokim98
Copy link
Contributor

issue

구현 사항

EditAccount에서 event 정보를 api로 불러오지 않고 navigate state로 전달 받도록 수정

Event api가 SuspenseQuery로 구현되어있어 이를 외부에서 Suspense로 감싸줘야 하지만 router에서 EditAccount는 이벤트 로더 바깥에 있어서 감싸있지 않기 때문에 발생한 에러였습니다. 그래서 EditAccountPage에서 event를 api로 요청하지 않고 계좌번호 정보를 navigate state로 받도록 수정했습니다.

const location = useLocation();
const locationState = location.state as BankAccount | null;

주소 창에 admin/edit-account로 입력한 것은 의도하지 않은 방법으로 들어왔다고 생각하기 때문에 다시 admin 페이지로 돌리는 기능도 넣었어요

  useEffect(() => {
    if (locationState === null) {
      navigate(`${getEventBaseUrl(location.pathname)}/admin`);
    } else {
      setBankName(locationState.bankName);
      setAccountNumber(locationState.accountNumber);
    }
  }, [locationState]);

🫡 참고사항

Copy link

@woowacourse-teams woowacourse-teams deleted a comment from github-actions bot Dec 18, 2024
@jinhokim98 jinhokim98 merged commit 411fd6d into fe-dev Dec 19, 2024
2 checks passed
@jinhokim98 jinhokim98 deleted the feature/#865 branch December 19, 2024 06:05
@Todari Todari mentioned this pull request Jan 8, 2025
Todari added a commit that referenced this pull request Jan 8, 2025
* refactor: directory 및 page, route 구조와 일부 이름 변경

* fix: 쿠키 없을 때 행사 로그인 버그 해결

* fix: 변경된 route에 따라, navigate()수정

* style: lint 적용

* fix: 파일 대소문자 문제 해결

* fix: EventLoader 외부에서 event 호출하는 것을 navigate state로 넘김으로써 Suspense 감싸주지 않아도 해결되도록 수정

---------

Co-authored-by: 이태훈 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[FE] 이벤트 계좌번호 수정을 url로 진입할 경우 에러 발생하는 문제 해결
3 participants