Merge branch 'main' into project-list
This commit is contained in:
commit
b374d9ce80
@ -41,22 +41,18 @@ $api.interceptors.response.use(
|
|||||||
const loadingStore = useLoadingStore();
|
const loadingStore = useLoadingStore();
|
||||||
loadingStore.stopLoading();
|
loadingStore.stopLoading();
|
||||||
|
|
||||||
|
// 테스트 부탁
|
||||||
// 로그인 실패, 커스텀 에러 응답 처리 (status는 200 success가 false인 경우)
|
// 로그인 실패, 커스텀 에러 응답 처리 (status는 200 success가 false인 경우)
|
||||||
if (response.data && response.data.success === false) {
|
if (response.data.code > 10000) {
|
||||||
const toastStore = useToastStore();
|
const toastStore = useToastStore();
|
||||||
const errorCode = response.data.code;
|
const errorCode = response.data.code;
|
||||||
const errorMessage = response.data.message || '알 수 없는 오류가 발생했습니다.';
|
const errorMessage = response.data.message || '알 수 없는 오류가 발생했습니다.';
|
||||||
|
|
||||||
// 로그인 요청일 경우 (헤더에 isLogin이 true로 설정된 경우)
|
|
||||||
if (response.config.headers && response.config.headers.isLogin) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 서버에서 보낸 메시지 사용
|
// 서버에서 보낸 메시지 사용
|
||||||
toastStore.onToast(errorMessage, 'e');
|
toastStore.onToast(errorMessage, 'e');
|
||||||
|
|
||||||
// 특정 에러 코드에 대한 추가 처리만 수행
|
// 특정 에러 코드에 대한 추가 처리만 수행
|
||||||
if (errorCode === 'USER_NOT_FOUND') {
|
if (errorCode === 10001) {
|
||||||
router.push('/login');
|
router.push('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user