From 190c0a62eab9789b071515eb1e80a8b6380f7050 Mon Sep 17 00:00:00 2001
From: Bastien Dumont <bdumont@grandlyon.com>
Date: Wed, 17 Apr 2024 15:58:27 +0200
Subject: [PATCH] chore(grdf): remove waiting modal

---
 src/components/Konnector/KonnectorModal.tsx      | 7 -------
 src/components/Konnector/KonnectorViewerCard.tsx | 9 ++++++++-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/components/Konnector/KonnectorModal.tsx b/src/components/Konnector/KonnectorModal.tsx
index c03c05a0b..5a16d77da 100644
--- a/src/components/Konnector/KonnectorModal.tsx
+++ b/src/components/Konnector/KonnectorModal.tsx
@@ -4,7 +4,6 @@ import EnedisIcon from 'assets/icons/ico/consent-outdated-enedis.svg'
 import errorIcon from 'assets/icons/visu/data-nok.svg'
 import successIcon from 'assets/icons/visu/data-ok.svg'
 import classNames from 'classnames'
-import { GrdfWaitConsent } from 'components/Connection/GRDFConnect/GrdfWaitConsent'
 import Loader from 'components/Loader/Loader'
 import connectionWaitingText from 'constants/connectionWaitingText.json'
 import firstConnectionWaitingText from 'constants/firstConnectionWaitingText.json'
@@ -264,15 +263,9 @@ const KonnectorModal = ({
                         </div>
                       </div>
                     )}
-                  {/* Wait consent alert */}
-                  {error === KonnectorError.CHALLENGE_ASKED &&
-                    fluidType === FluidType.GAS && (
-                      <GrdfWaitConsent showRelaunch={false} />
-                    )}
 
                   {error !== KonnectorError.LOGIN_FAILED &&
                     error !== KonnectorError.TERMS_VERSION_MISMATCH &&
-                    error !== KonnectorError.CHALLENGE_ASKED &&
                     error !==
                       KonnectorError.USER_ACTION_NEEDED_ACCOUNT_REMOVED && (
                       // DEFAULT CASE
diff --git a/src/components/Konnector/KonnectorViewerCard.tsx b/src/components/Konnector/KonnectorViewerCard.tsx
index 4b202499a..828f8bcff 100644
--- a/src/components/Konnector/KonnectorViewerCard.tsx
+++ b/src/components/Konnector/KonnectorViewerCard.tsx
@@ -298,13 +298,20 @@ const KonnectorViewerCard = ({
           await refreshChallengeState(),
           await updateGlobalFluidStatus(),
         ])
+
         setKonnectorState(_state)
+        /** If waiting for consent, close Konnector modal */
+        if (isWaitingForConsent) {
+          setOpenModal(false)
+          setKonnectorState(null)
+        }
       }
     },
     [
-      dispatch,
       currentFluidStatus.connection,
       currentFluidStatus.fluidType,
+      dispatch,
+      isWaitingForConsent,
       refreshChallengeState,
       updateGlobalFluidStatus,
     ]
-- 
GitLab