refactor: add success notification on register, remove success from route form and auto login call
This commit is contained in:
parent
6fbbe4975c
commit
729414c45a
|
@ -124,7 +124,12 @@ export const createPortalAuthProvider = (sdk: Sdk): AuthProvider => {
|
||||||
first_name: params.firstName,
|
first_name: params.firstName,
|
||||||
last_name: params.lastName,
|
last_name: params.lastName,
|
||||||
});
|
});
|
||||||
return handleResponse({ret, redirectToSuccess: "/login"});
|
return handleResponse({
|
||||||
|
ret, redirectToSuccess: "/login", successNotification: {
|
||||||
|
message: "Registration Successful",
|
||||||
|
description: "You have successfully registered. Please check your email to verify your account.",
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
async forgotPassword(params: any): Promise<AuthActionResponse> {
|
async forgotPassword(params: any): Promise<AuthActionResponse> {
|
||||||
|
|
|
@ -47,11 +47,11 @@ export default function Register() {
|
||||||
const login = useLogin<AuthFormRequest>();
|
const login = useLogin<AuthFormRequest>();
|
||||||
const { open } = useNotification();
|
const { open } = useNotification();
|
||||||
const [form, fields] = useForm({
|
const [form, fields] = useForm({
|
||||||
id: "register",
|
id: "register",
|
||||||
constraint: getZodConstraint(RegisterSchema),
|
constraint: getZodConstraint(RegisterSchema),
|
||||||
onValidate({ formData }) {
|
onValidate({formData}) {
|
||||||
return parseWithZod(formData, { schema: RegisterSchema });
|
return parseWithZod(formData, {schema: RegisterSchema});
|
||||||
},
|
},
|
||||||
onSubmit(e) {
|
onSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
@ -61,23 +61,9 @@ export default function Register() {
|
||||||
password: data.password.toString(),
|
password: data.password.toString(),
|
||||||
firstName: data.firstName.toString(),
|
firstName: data.firstName.toString(),
|
||||||
lastName: data.lastName.toString(),
|
lastName: data.lastName.toString(),
|
||||||
}, {
|
})
|
||||||
onSuccess: () => {
|
}
|
||||||
open?.({
|
});
|
||||||
type: "success",
|
|
||||||
message: "Verify your Email",
|
|
||||||
description: "An Email was sent to your email address. Please verify your email address to activate your account.",
|
|
||||||
key: "register-success"
|
|
||||||
})
|
|
||||||
login.mutate({
|
|
||||||
email: data.email.toString(),
|
|
||||||
password: data.password.toString(),
|
|
||||||
rememberMe: false,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-10 h-screen relative">
|
<div className="p-10 h-screen relative">
|
||||||
|
|
Loading…
Reference in New Issue