mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2024-11-17 06:19:25 +08:00
Fixed registration page
This commit is contained in:
parent
fb7b77efb7
commit
4a00dd1817
2 changed files with 11 additions and 8 deletions
|
@ -48,10 +48,10 @@ export function UserRegister(register: RegistrationParams) {
|
||||||
return instance
|
return instance
|
||||||
.post("/api/v1/accounts/users/", register)
|
.post("/api/v1/accounts/users/", register)
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
return [response.status];
|
return [true, response.status];
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
return [error.response.status, error.response.data];
|
return [false, error.response.status, error.response.data];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,12 +141,7 @@ export default function Register() {
|
||||||
last_name: user.last_name,
|
last_name: user.last_name,
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
try {
|
if (result[0]) {
|
||||||
setUser({
|
|
||||||
...user,
|
|
||||||
feedback: ParseError(JSON.stringify(result[1])),
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
setUser({
|
setUser({
|
||||||
...user,
|
...user,
|
||||||
first_name: "",
|
first_name: "",
|
||||||
|
@ -158,6 +153,14 @@ export default function Register() {
|
||||||
feedback:
|
feedback:
|
||||||
"Success! An email has been sent to activate your account",
|
"Success! An email has been sent to activate your account",
|
||||||
});
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
navigation.navigate("Login");
|
||||||
|
}, 10000);
|
||||||
|
} else {
|
||||||
|
setUser({
|
||||||
|
...user,
|
||||||
|
feedback: ParseError(JSON.stringify(result[2])),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue