edited signup to include sane redirect to login

This commit is contained in:
ak 2023-09-30 23:29:12 -07:00
parent aeb32a576f
commit 9ff4df4a2b

View file

@ -15,6 +15,7 @@ const createUser = (username, password) => {
Accept: "application/json",
"Content-Type": "application/json;charset=UTF-8",
},
credential: "include",
body: JSON.stringify({
username: username,
password: password,
@ -25,14 +26,10 @@ const createUser = (username, password) => {
(res) => {
// if everything sent ok
if (res.ok) {
// automatically login for new user
fetch(`${import.meta.env.VITE_BACKEND_URL}/login`, options).then(() => {
// indicate that a reload is needed
localStorage.setItem("needsReload", "true");
router.push("/");
});
alert("Success! Please use your new credentials to login!");
router.push("/login");
} else {
alert("There were errors! Please try again!");
alert("Errors encountered! Please try again!");
}
}
);