From 2ae9b736132414afe104e0e89f88f64a80dba721 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Mon, 17 Apr 2023 05:45:41 +0100 Subject: [PATCH 1/2] made error message to display blow and disappears after 5secs --- src/app/modules/auth/components/Login.tsx | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/app/modules/auth/components/Login.tsx b/src/app/modules/auth/components/Login.tsx index ff2e053..1d07f09 100644 --- a/src/app/modules/auth/components/Login.tsx +++ b/src/app/modules/auth/components/Login.tsx @@ -49,18 +49,20 @@ export function Login() { setStatus('The login details are incorrect') setSubmitting(false) setLoading(false) - console.log(auth) //remove later return } saveAuth(auth) setCurrentUser(auth.profile) - console.log(auth) //remove later } catch (error) { console.error(error) saveAuth(undefined) setStatus('The login details are incorrect') setSubmitting(false) setLoading(false) + } finally { + setTimeout(()=>{ + setStatus('') + }, 5000) } }, }) @@ -130,14 +132,6 @@ export function Login() { {/* end::Separator */} - {formik.status ? ( -
-
{formik.status}
-
- ) : ( - null - )} - {/* begin::Form group */}
@@ -221,6 +215,16 @@ export function Login() {
{/* end::Action */} + {/* error message */} + {formik.status ? ( +
+
{formik.status}
+
+ ) : ( + null + )} + {/* end of error message */} +
Not a Member yet?{' '} From 94f23547851457f819006a6df6fab03b5b6d77cd Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Mon, 17 Apr 2023 06:26:30 +0100 Subject: [PATCH 2/2] made login error timeout configurable --- .env | 4 +++- src/app/modules/auth/components/Login.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.env b/.env index ee32553..9f61bae 100644 --- a/.env +++ b/.env @@ -17,4 +17,6 @@ REACT_APP_THEME_API_URL=https://preview.keenthemes.com/theme-api/api REACT_APP_SITE_CONTACT_US=https://www.float.sg/contact REACT_APP_SITE_TERMS=https://www.float.sg/terms -REACT_APP_SITE_ABOUT_US=https://www.float.sg/about \ No newline at end of file +REACT_APP_SITE_ABOUT_US=https://www.float.sg/about + +REACT_APP_LOGIN_ERROR_TIMEOUT=5000 \ No newline at end of file diff --git a/src/app/modules/auth/components/Login.tsx b/src/app/modules/auth/components/Login.tsx index 1d07f09..4371d9d 100644 --- a/src/app/modules/auth/components/Login.tsx +++ b/src/app/modules/auth/components/Login.tsx @@ -62,7 +62,7 @@ export function Login() { } finally { setTimeout(()=>{ setStatus('') - }, 5000) + }, Number(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT)) } }, })