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,
|
||||
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> {
|
||||
|
|
|
@ -49,8 +49,8 @@ export default function Register() {
|
|||
const [form, fields] = useForm({
|
||||
id: "register",
|
||||
constraint: getZodConstraint(RegisterSchema),
|
||||
onValidate({ formData }) {
|
||||
return parseWithZod(formData, { schema: RegisterSchema });
|
||||
onValidate({formData}) {
|
||||
return parseWithZod(formData, {schema: RegisterSchema});
|
||||
},
|
||||
onSubmit(e) {
|
||||
e.preventDefault();
|
||||
|
@ -61,20 +61,6 @@ export default function Register() {
|
|||
password: data.password.toString(),
|
||||
firstName: data.firstName.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,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue