edited signup to include sane redirect to login
This commit is contained in:
parent
aeb32a576f
commit
9ff4df4a2b
1 changed files with 4 additions and 7 deletions
|
|
@ -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!");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue