Skip to content

Commit

Permalink
Feat: #80 로그인 API의 withCredentials 옵션 삭제, 토큰 발급 실패 시 에러 처리 방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoonyesol committed Sep 3, 2024
1 parent e6fbaa7 commit ad954d4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion src/pages/user/SignInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default function SignInPage() {
},
});

// TODO: react-query 코드 분리하기
const signIn = useMutation({
mutationFn: (data: UserSignInForm) => login(data),
onSuccess: (response) => {
Expand Down
6 changes: 1 addition & 5 deletions src/services/axiosProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ authAxios.interceptors.response.use(
const refreshResponse = await getAccessToken();
const newAccessToken = refreshResponse.headers.Authorization; // 응답값: `Bearer newAccessToken`

if (!newAccessToken) {
toastError('토큰 발급에 실패했습니다. 다시 로그인 해주세요.');
onLogout();
return;
}
if (!newAccessToken) throw new Error('토큰 발급에 실패했습니다.');

setAccessToken(newAccessToken.split(' ')[1]);

Expand Down

0 comments on commit ad954d4

Please sign in to comment.