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