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

View file

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

View file

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