문제상황
분리된 API 파일(StorePostApi.js)에서는 response 로그를 남길 경우 나오지만
react파일(StorePage.js)에서 res 값을 찍을 경우 나오지 않음
// StorePage.js API호출 부분
StorePostApi(data)
.then(res =>{
console.log("res",res)
if(res){
setUserCheck(true);
setTimeout(() => {
navigate('/signup/stores/pos');
}, 500);
} else{
throw new Error("토큰이 없습니다")
}
})
.catch(err=>{
console.error('API 호출 또는 토큰 발급 실패:',err)
})
방법 (해결)
StorePostApi 함수에서 직접적으로 axios의 응답을 사용하도록 변경
728x90