@@ -4,6 +4,7 @@ import LoginSignupInputBox from "../layout/input/LoginSignupInputBox";
4
4
import IsModal from "../modal/Modal" ;
5
5
import { useNavigate } from "react-router" ;
6
6
import { UserApi } from "../../api/UserApi" ;
7
+ import { async } from "q" ;
7
8
8
9
const ChangePassword = ( ) => {
9
10
const navigator = useNavigate ( ) ;
@@ -42,6 +43,7 @@ const ChangePassword = () => {
42
43
if ( InputCheck . modal && userId ) {
43
44
navigator ( "/main" ) ;
44
45
} else if ( InputCheck . modal && email ) {
46
+ console . log ( "Login페이지로 가줘" ) ;
45
47
navigator ( "/login" ) ;
46
48
} else if ( ! InputCheck . input && ! InputCheck . modal ) {
47
49
navigator ( "/login/auth/InputEmail" ) ;
@@ -176,31 +178,33 @@ const ChangePassword = () => {
176
178
177
179
const onCangePassWordAxios = async ( payload ) => {
178
180
try {
179
- setIsLoding ( ( ) => true ) ;
181
+ setIsLoding ( true ) ;
180
182
onModalOpen ( ) ;
181
183
const data = await UserApi . passwordChange ( payload ) ;
182
- setIsLoding ( ( ) => false ) ;
184
+ setIsLoding ( false ) ;
183
185
console . log ( data ) ;
184
186
if ( data . status === 200 ) {
187
+ setInputCheck ( { ...InputCheck , modal : true } ) ;
185
188
sessionStorage . removeItem ( "changePasswordEmail" ) ;
186
- setInputCheck ( ( ) => ( { ...InputCheck , modal : true } ) ) ;
187
- setModalStr ( ( ) => ( {
189
+ console . log ( "동작확인" , setInputCheck ) ;
190
+ console . log ( "동작확인" , InputCheck . modal ) ;
191
+ setModalStr ( {
188
192
...ModalStr ,
189
193
modalTitle : "비밀번호 변경을 성공했어요" ,
190
194
modalMessage : "새로운 비밀번호로 변경이 되었습니다. " ,
191
- } ) ) ;
195
+ } ) ;
192
196
}
193
197
} catch ( error ) {
194
198
const { data } = error . response ;
195
- setIsLoding ( ( ) => false ) ;
199
+ setIsLoding ( false ) ;
196
200
if ( data . status === 400 ) {
197
- setInputCheck ( ( ) => ( { input : false , modal : false } ) ) ;
198
- setModalStr ( ( ) => ( {
201
+ setInputCheck ( { input : false , modal : false } ) ;
202
+ setModalStr ( {
199
203
...ModalStr ,
200
204
modalTitle : "비밀번호변경 실패" ,
201
205
modalMessage :
202
206
"인증번호가 유효하지 않습니다. \n 다시 인증요청을 재시도 해주세요." ,
203
- } ) ) ;
207
+ } ) ;
204
208
}
205
209
}
206
210
} ;
0 commit comments