변경 전
const onSubmitHandler = (e) => {
e.preventDefault();
console.log(email, password);
let body = {
email,
password
}
dispatch(loginUser(body)).then((res) => {
if(res.payload.loginSuccess){
props.history.push('/'); <---------------------- 이부분
window.location.reload();
}else{
alert("ERROR");
}
})
}
변경 후
const onSubmitHandler = (e) => {
e.preventDefault();
console.log(email, password);
let body = {
email,
password
}
dispatch(loginUser(body)).then((res) => {
if(res.payload.loginSuccess){
navigate('/');<----------------------------- 변경된 부분
window.location.reload();
}else{
alert("ERROR");
}
})
}