forked from fr/deguapp
Fixes: error handling on signup page #13
This commit is contained in:
parent
61449caef1
commit
5a2a2db5e2
@ -16,23 +16,28 @@ function SignupPage() {
|
|||||||
const { onSignin } = useAuth();
|
const { onSignin } = useAuth();
|
||||||
|
|
||||||
async function signin() {
|
async function signin() {
|
||||||
if (pass1 == pass2) {
|
if (pass1 != pass2) {
|
||||||
const res = await onSignin(username, email, pass1);
|
alert("Passwords are not same!");
|
||||||
if (res.error) {
|
return;
|
||||||
if (res.msg.message == "validation error") {
|
}
|
||||||
alert(res.msg.data.message);
|
|
||||||
} else {
|
const res = await onSignin(username, email, pass1);
|
||||||
alert(res.msg.message);
|
const data = await res.json();
|
||||||
}
|
|
||||||
}
|
if (res.status == 400) {
|
||||||
if (!res.error) {
|
if (data.message == "validation error") {
|
||||||
alert("You have been successfully registered. Please Log In");
|
alert(data.data.message);
|
||||||
router.replace("/login");
|
} else {
|
||||||
|
alert("Something went wrong");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
alert("Passwords are not same!");
|
if (res.status == 201) {
|
||||||
|
alert("You have been successfully registered. Please Log In");
|
||||||
|
router.replace("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user