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

[FEAT] 인터뷰 룸 관련 페이지 반응형 디자인 적용 및 토큰 에러 인터셉터 작성 #58

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

moondrop0816
Copy link
Contributor

Summary

인터뷰 룸과 관련된 페이지들에 반응형 디자인을 적용하고, 모든 요청시 토큰 에러에 대비해 인터셉터를 작성했습니다.

Description

작업이 너무 늦어졌습니다. 죄송해요🥹

  • 인터뷰 리스트, 인터뷰 상세 페이지, 인터뷰 검색 페이지에 반응형 디자인을 적용했습니다.
    모바일의 경우 320까지 확인했습니다. 혹시 깨지는 부분이 있다면 알려주세요!

  • 요청시 토큰 만료 등의 에러에 대비해 최상위 컴포넌트에 인터셉터를 작성했습니다.
    모든 요청시 401, 419 에러가 발생하면 silentRefresh를 실행하고, 성공할 경우 이전에 보냈던 요청을 재요청하도록 작성했습니다.

Linked issue

Closes #30

@moondrop0816 moondrop0816 added ✨ Feature 기능 추가 🎨 Style 디자인 적용 labels Aug 2, 2023
@moondrop0816 moondrop0816 requested a review from yoouyeon August 2, 2023 07:36
@moondrop0816 moondrop0816 self-assigned this Aug 2, 2023
Copy link
Member

@yoouyeon yoouyeon left a comment

Choose a reason for hiding this comment

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

리뷰가 늦어서 죄송합니다...ㅜㅜ

intercept 작업은 다시 확인해보셔야 할 것 같습니다!!
인터뷰룸 반응형 작업은,, 인터뷰 리스트랑 인터뷰룸 내 자소서 입력 부분까진 확인했는데 그 외 부분은 api 오류와 무료 사용랑 오버 이슈로 (ㅋㅋㅜㅜㅜㅜ) 체크를 못해봤습니다..!! api 문제 해결되면 다시 확인해보도록 하겠습니다!!! 😂

수고하셨습니다👏👏👏

Comment on lines +27 to +53
axios.interceptors.response.use(
(res) => res,
async (err) => {
const status = err.response.status;
if (status === 419 || status === 401) {
silentRefresh().catch((err) => {
if (isAxiosError(err)) {
logoutFn();
switch (status) {
case 400:
alert('세션이 만료되었습니다. 다시 로그인 해주세요.');
break;
default:
navigate(`/error/500`);
}
navigate('/sign-in');
}
});

// 토큰 재발급 성공시
const originalResponse = await axios.request(err.config);
return originalResponse;
}

return Promise.reject(err);
}
);
Copy link
Member

Choose a reason for hiding this comment

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

혹시 이부분 테스트 해보셨나요?? 로그인되지 않은 상태에서 로그인이 필요한 페이지로 접근했을 때 auth와 refresh를 무한 재요청하고 있습니다........ㅜㅜ
아마 인터셉터가 전역으로 설정되어 있어서가 아닐까 싶은데 (auth에서 intercept, refresh에서 intercept.... 반복? 그냥 제 예상입니다)
이 문제가 아니더라도 axios 설정 로직이 길어지니까 App.tsx에서 분리하는게 좋을 것 같아서 intercept가 필요한 요청은 따로 axios instance를 만들어서 쓰는게 좀 더 깔끔할 것 같다는 생각이 듭니다...ㅎㅎ

auth, refresh 재요청 하는 부분은 다시 확인해보셔야 할 것 같습니다!!!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

으아아 죄송합니다 제가 테스트가 부족했어요..ㅠㅠㅠㅠ 다른 요청시 토큰 만료 에러가 잘 동작하는지만 확인하고 로그인 하지 않았을때를 제대로 확인해보지 않은거같아요ㅠ 이부분은 auth, refresh 등 로그인 부분만 별도의 axios 인스턴스를 작성해서 해결해보겠습니다...!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 추가 🎨 Style 디자인 적용
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[STYLE] 반응형 디자인 적용
2 participants