From 3047d318322ac76a9cfa7bfcafd3fae44e9340ce Mon Sep 17 00:00:00 2001 From: je1999 Date: Thu, 2 May 2024 09:10:11 -0400 Subject: [PATCH] fix: loading stops prematurely on fullscreen transition loading stops executing or presenting before moving to the second step --- src/app/[lang]/identification/form.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/[lang]/identification/form.tsx b/src/app/[lang]/identification/form.tsx index 58a37818..66eb6be3 100644 --- a/src/app/[lang]/identification/form.tsx +++ b/src/app/[lang]/identification/form.tsx @@ -81,24 +81,25 @@ export function Form() { const { isHuman } = await validateRecaptcha(reCaptchaToken); if (!isHuman) { + setLoading(false); return AlertError(intl.errors.recaptcha.validation); } const { exists } = await findIamCitizen(cedula); if (exists) { + setLoading(false); return AlertError(intl.errors.cedula.exists); } const citizen = await findCitizen(cedula); await setCookie('citizen', citizen); router.push('liveness'); + setLoading(false); } catch (err: any) { Sentry.captureMessage(err.message || err, 'error'); - - return AlertError(intl.errors.cedula.invalid); - } finally { setLoading(false); + return AlertError(intl.errors.cedula.invalid); } });