From c8cff9cbb4489eb6e8a6f7ec0b13b7f75324a9dd Mon Sep 17 00:00:00 2001 From: swve Date: Sat, 15 Jun 2024 15:19:11 +0100 Subject: [PATCH] chore: misc improvements --- apps/web/app/auth/forgot/forgot.tsx | 1 + apps/web/app/auth/login/login.tsx | 17 +++++-- .../Create/NewActivityModal/DynamicCanva.tsx | 2 +- .../Dash/OrgAccess/OrgInviteCodeGenerate.tsx | 49 ++++++++++++------- 4 files changed, 45 insertions(+), 24 deletions(-) diff --git a/apps/web/app/auth/forgot/forgot.tsx b/apps/web/app/auth/forgot/forgot.tsx index 8b3cb7c2..ecfce06e 100644 --- a/apps/web/app/auth/forgot/forgot.tsx +++ b/apps/web/app/auth/forgot/forgot.tsx @@ -42,6 +42,7 @@ function ForgotPasswordClient() { email: '' }, validate, + validateOnBlur: true, onSubmit: async (values) => { setIsSubmitting(true) let res = await sendResetLink(values.email, org?.id) diff --git a/apps/web/app/auth/login/login.tsx b/apps/web/app/auth/login/login.tsx index e766cf51..49dd7161 100644 --- a/apps/web/app/auth/login/login.tsx +++ b/apps/web/app/auth/login/login.tsx @@ -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 + /> @@ -155,7 +164,7 @@ const LoginClient = (props: LoginClientProps) => { onChange={formik.handleChange} value={formik.values.password} type="password" - required + /> @@ -170,7 +179,7 @@ const LoginClient = (props: LoginClientProps) => {
- diff --git a/apps/web/components/Objects/Modals/Activities/Create/NewActivityModal/DynamicCanva.tsx b/apps/web/components/Objects/Modals/Activities/Create/NewActivityModal/DynamicCanva.tsx index faff1760..7d6082ab 100644 --- a/apps/web/components/Objects/Modals/Activities/Create/NewActivityModal/DynamicCanva.tsx +++ b/apps/web/components/Objects/Modals/Activities/Create/NewActivityModal/DynamicCanva.tsx @@ -59,7 +59,7 @@ function DynamicCanvaModal({ submitActivity, chapterId, course }: any) { -