Fixed activation page not redirecting properly on success and password reset fields not setting proper values

This commit is contained in:
Keannu Bernasol 2023-11-20 00:23:59 +08:00
parent 150663587c
commit 45c9fd588a
3 changed files with 9 additions and 9 deletions

View file

@ -63,9 +63,9 @@ export function ParseError(error: { response: { data: string } }) {
}
// User APIs
export function RegisterAPI(register: RegisterType) {
export function RegisterAPI(info: RegisterType) {
return instance
.post("api/v1/accounts/users/", register)
.post("api/v1/accounts/users/", info)
.then(async (response) => {
console.log(response.data);
return [true, 0];
@ -86,11 +86,11 @@ export function LoginAPI(user: LoginType, remember_session: boolean) {
setRefreshToken(response.data.refresh);
}
console.log("Login Success ");
console.log("Login Success");
return true;
})
.catch(() => {
console.log("Login Failed");
.catch((error) => {
console.log("Login Failed", error.response.data);
return false;
});
}

View file

@ -38,7 +38,7 @@ export default function ActivationPage() {
theme: "light",
});
setTimeout(() => {
navigate("/dashboard");
navigate("/");
});
} else {
setFeedback("Invalid activation link");

View file

@ -80,9 +80,9 @@ export default function ResetPasswordPage() {
label="Confirm Password"
placeholder={"Re-enter password"}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setUser({ ...user, password: e.target.value })
setUser({ ...user, confirm_password: e.target.value })
}
value={user.password}
value={user.confirm_password}
/>
<div style={{ justifyContent: "center", display: "flex" }}>
<div
@ -93,7 +93,7 @@ export default function ResetPasswordPage() {
height: "4px",
marginBottom: 8,
}}
/>{" "}
/>
</div>
<p style={{ ...styles.text_dark, ...styles.text_M }}>{feedback}</p>