From b302329e0f5baa3c130ae8c3c24342f3ad827750 Mon Sep 17 00:00:00 2001 From: Simon Nedjari Date: Wed, 20 Nov 2024 12:48:38 +0100 Subject: [PATCH] fix button disabling depend on required fields --- src/components/WelcomeModal/FirstPhase.tsx | 16 +++++++++++++--- src/pages/mon-compte.tsx | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/WelcomeModal/FirstPhase.tsx b/src/components/WelcomeModal/FirstPhase.tsx index f2a59445c..0cd8db20e 100644 --- a/src/components/WelcomeModal/FirstPhase.tsx +++ b/src/components/WelcomeModal/FirstPhase.tsx @@ -63,7 +63,7 @@ export const FirstPhase = () => { }; const updateUser = async () => { - if (!newUser.city || !newUser.address || !newUser.pseudo || !newUser.school || !newUser.email || !newUser.postalCode) { + if (!newUser.firstname || !newUser.lastname || !newUser.school || !newUser.level || !newUser.address || !newUser.city || !newUser.postalCode) { return; } setIsLoading(true); @@ -159,7 +159,17 @@ export const FirstPhase = () => { color={currentStep === 2 || currentStep === 4 ? 'primary' : 'inherit'} variant={currentStep === 2 || currentStep === 4 ? 'contained' : 'text'} sx={currentStep === 2 || currentStep === 4 ? undefined : defaultTextButtonStyle} - disabled={(currentStep === 3 && (!newUser.city || !newUser.address || !newUser.postalCode)) || (currentStep === 2 && !cguChecked)} + disabled={ + (currentStep === 3 && + (!newUser.firstname || + !newUser.lastname || + !newUser.school || + !newUser.level || + !newUser.address || + !newUser.city || + !newUser.postalCode)) || + (currentStep === 2 && !cguChecked) + } onClick={() => { if (currentStep === 3) { getNewUserPosition().catch(); @@ -270,7 +280,7 @@ export const FirstPhase = () => {
- Professionnel de l'éducation + Professionnel de l'éducation {