【发布时间】:2021-10-18 19:22:02
【问题描述】:
我已经在 Heroku 上部署了我的第一个 MERN 应用程序。尝试登录我的应用程序时,我在位置 0 处收到 500 (Internal Server Error) 和 SyntaxError: Unexpected token
const onSubmit = (e) => {
e.preventDefault();
fetch("/api/users/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
email,
password
})
})
.then((response) => response.json())
.then((data) => {
setForm({ email: "", password: "" });
localStorage.setItem("jwt", data.token);
dispatch(set_loggedUser(data.user));
dispatch(set_islogged());
history.push("/");
})
.catch((err) => console.log(err));
};
【问题讨论】:
标签: node.js reactjs express heroku mern