mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
chore: misc improvements
This commit is contained in:
parent
46e09f27c2
commit
c8cff9cbb4
4 changed files with 45 additions and 24 deletions
|
|
@ -42,6 +42,7 @@ function ForgotPasswordClient() {
|
|||
email: ''
|
||||
},
|
||||
validate,
|
||||
validateOnBlur: true,
|
||||
onSubmit: async (values) => {
|
||||
setIsSubmitting(true)
|
||||
let res = await sendResetLink(values.email, org?.id)
|
||||
|
|
|
|||
|
|
@ -51,8 +51,17 @@ const LoginClient = (props: LoginClientProps) => {
|
|||
password: '',
|
||||
},
|
||||
validate,
|
||||
onSubmit: async (values) => {
|
||||
validateOnBlur: true,
|
||||
validateOnChange: true,
|
||||
onSubmit: async (values, {validateForm, setErrors, setSubmitting}) => {
|
||||
setIsSubmitting(true)
|
||||
const errors = await validateForm(values);
|
||||
if (Object.keys(errors).length > 0) {
|
||||
setErrors(errors);
|
||||
setSubmitting(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await signIn('credentials', {
|
||||
redirect: false,
|
||||
email: values.email,
|
||||
|
|
@ -139,7 +148,7 @@ const LoginClient = (props: LoginClientProps) => {
|
|||
onChange={formik.handleChange}
|
||||
value={formik.values.email}
|
||||
type="email"
|
||||
required
|
||||
|
||||
/>
|
||||
</Form.Control>
|
||||
</FormField>
|
||||
|
|
@ -155,7 +164,7 @@ const LoginClient = (props: LoginClientProps) => {
|
|||
onChange={formik.handleChange}
|
||||
value={formik.values.password}
|
||||
type="password"
|
||||
required
|
||||
|
||||
/>
|
||||
</Form.Control>
|
||||
</FormField>
|
||||
|
|
@ -170,7 +179,7 @@ const LoginClient = (props: LoginClientProps) => {
|
|||
</div>
|
||||
<div className="flex py-4">
|
||||
<Form.Submit asChild>
|
||||
<button className="w-full bg-black text-white font-bold text-center p-2 rounded-md shadow-md hover:cursor-pointer">
|
||||
<button className="w-full bg-black text-white font-bold text-center p-2 rounded-md shadow-md hover:cursor-pointer">
|
||||
{isSubmitting ? 'Loading...' : 'Login'}
|
||||
</button>
|
||||
</Form.Submit>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue