Skip to content

Commit 73d2f96

Browse files
author
Ju
committed
Feat/Router gnims-project#92 Router 비밀번호 변경 오류 수정 피드백
1 parent b82c0c5 commit 73d2f96

File tree

2 files changed

+31
-26
lines changed

2 files changed

+31
-26
lines changed

src/components/mypage/ChangePassword.jsx

+13-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import LoginSignupInputBox from "../layout/input/LoginSignupInputBox";
44
import IsModal from "../modal/Modal";
55
import { useNavigate } from "react-router";
66
import { UserApi } from "../../api/UserApi";
7+
import { async } from "q";
78

89
const ChangePassword = () => {
910
const navigator = useNavigate();
@@ -42,6 +43,7 @@ const ChangePassword = () => {
4243
if (InputCheck.modal && userId) {
4344
navigator("/main");
4445
} else if (InputCheck.modal && email) {
46+
console.log("Login페이지로 가줘");
4547
navigator("/login");
4648
} else if (!InputCheck.input && !InputCheck.modal) {
4749
navigator("/login/auth/InputEmail");
@@ -176,31 +178,33 @@ const ChangePassword = () => {
176178

177179
const onCangePassWordAxios = async (payload) => {
178180
try {
179-
setIsLoding(() => true);
181+
setIsLoding(true);
180182
onModalOpen();
181183
const data = await UserApi.passwordChange(payload);
182-
setIsLoding(() => false);
184+
setIsLoding(false);
183185
console.log(data);
184186
if (data.status === 200) {
187+
setInputCheck({ ...InputCheck, modal: true });
185188
sessionStorage.removeItem("changePasswordEmail");
186-
setInputCheck(() => ({ ...InputCheck, modal: true }));
187-
setModalStr(() => ({
189+
console.log("동작확인", setInputCheck);
190+
console.log("동작확인", InputCheck.modal);
191+
setModalStr({
188192
...ModalStr,
189193
modalTitle: "비밀번호 변경을 성공했어요",
190194
modalMessage: "새로운 비밀번호로 변경이 되었습니다. ",
191-
}));
195+
});
192196
}
193197
} catch (error) {
194198
const { data } = error.response;
195-
setIsLoding(() => false);
199+
setIsLoding(false);
196200
if (data.status === 400) {
197-
setInputCheck(() => ({ input: false, modal: false }));
198-
setModalStr(() => ({
201+
setInputCheck({ input: false, modal: false });
202+
setModalStr({
199203
...ModalStr,
200204
modalTitle: "비밀번호변경 실패",
201205
modalMessage:
202206
"인증번호가 유효하지 않습니다. \n 다시 인증요청을 재시도 해주세요.",
203-
}));
207+
});
204208
}
205209
}
206210
};

src/shared/AxiosInstance.jsx

+18-17
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,23 @@ instance.interceptors.request.use(
2828
}
2929
);
3030

31-
instance.interceptors.response.use(
32-
function (response) {
33-
return response;
34-
},
35-
function (error) {
36-
const errMsg = error.response.status;
31+
// instance.interceptors.response.use(
32+
// function (response) {
33+
// console.log(response);
34+
// return response;
35+
// },
36+
// function (error) {
37+
// const errMsg = error.response.status;
3738

38-
if (errMsg === 401) {
39-
window.location.href = "/login";
40-
return;
41-
}
39+
// if (errMsg === 401) {
40+
// window.location.href = "/login";
41+
// return;
42+
// }
4243

43-
if (errMsg === 500) {
44-
window.location.href = "/*";
45-
return;
46-
}
47-
return Promise.reject(error);
48-
}
49-
);
44+
// if (errMsg === 500) {
45+
// window.location.href = "/*";
46+
// return;
47+
// }
48+
// return Promise.reject(error);
49+
// }
50+
// );

0 commit comments

Comments
 (0)