From 1f197476e3afbe16c7b8976f7e208032ad658e9a Mon Sep 17 00:00:00 2001
From: Bastien Dumont <bdumont@grandlyon.com>
Date: Tue, 23 Apr 2024 17:06:22 +0200
Subject: [PATCH] cleanup

---
 src/components/Connection/GRDFConnect/GrdfInit.tsx        | 8 --------
 src/components/Connection/GRDFConnect/GrdfWaitConsent.tsx | 2 --
 .../Konnector/ConnectionResult/ConnectionResult.tsx       | 1 -
 src/components/Konnector/KonnectorModal.spec.tsx          | 6 ------
 src/components/Konnector/KonnectorViewerCard.tsx          | 6 +++---
 5 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/components/Connection/GRDFConnect/GrdfInit.tsx b/src/components/Connection/GRDFConnect/GrdfInit.tsx
index 5341f02a4..8793804da 100644
--- a/src/components/Connection/GRDFConnect/GrdfInit.tsx
+++ b/src/components/Connection/GRDFConnect/GrdfInit.tsx
@@ -16,14 +16,6 @@ const GrdfInit = () => {
   const { fluidStatus } = useAppSelector(state => state.ecolyo.global)
   const currentFluidStatus = fluidStatus[FluidType.GAS]
 
-  // /** Show wait consent screen when consent is "A valider" */
-  // const isWaitingForConsent =
-  //   currentFluidStatus.status === FluidState.CHALLENGE_ASKED
-
-  // if (isWaitingForConsent) {
-  //   return null
-  // }
-
   return (
     <div className="connection-form">
       <h2 className="connection-form-title grdfgrandlyon text-20-bold">
diff --git a/src/components/Connection/GRDFConnect/GrdfWaitConsent.tsx b/src/components/Connection/GRDFConnect/GrdfWaitConsent.tsx
index 1a5f8def6..d5b0c6773 100644
--- a/src/components/Connection/GRDFConnect/GrdfWaitConsent.tsx
+++ b/src/components/Connection/GRDFConnect/GrdfWaitConsent.tsx
@@ -18,7 +18,6 @@ export const GrdfWaitConsent = () => {
   const [consentEmail, setConsentEmail] = useState('')
 
   const updateKonnector = async () => {
-    // TODO call update() from useKonnectorAuth ?
     const updatedConnection: FluidConnection = {
       ...currentFluidStatus.connection,
       shouldLaunchKonnector: true,
@@ -58,7 +57,6 @@ export const GrdfWaitConsent = () => {
         <br />
         <span>{t('auth.grdfgrandlyon.waiting.comeback')}</span>
       </div>
-
       <Button className="btnPrimary" onClick={updateKonnector}>
         {t('auth.grdfgrandlyon.waiting.button_done')}
       </Button>
diff --git a/src/components/Konnector/ConnectionResult/ConnectionResult.tsx b/src/components/Konnector/ConnectionResult/ConnectionResult.tsx
index 78b0fce3f..232a41835 100644
--- a/src/components/Konnector/ConnectionResult/ConnectionResult.tsx
+++ b/src/components/Konnector/ConnectionResult/ConnectionResult.tsx
@@ -48,7 +48,6 @@ const ConnectionResult = ({
     setStatus('')
     setLastExecutionDate('-')
     setKonnectorError('')
-    // TODO call update from useKonnectorAuth ?
     const updatedConnection: FluidConnection = {
       ...currentFluidStatus.connection,
       shouldLaunchKonnector: true,
diff --git a/src/components/Konnector/KonnectorModal.spec.tsx b/src/components/Konnector/KonnectorModal.spec.tsx
index d3f7fbe83..43abb783b 100644
--- a/src/components/Konnector/KonnectorModal.spec.tsx
+++ b/src/components/Konnector/KonnectorModal.spec.tsx
@@ -18,7 +18,6 @@ describe('KonnectorModal component', () => {
       <Provider store={store}>
         <KonnectorModal
           open={true}
-          isUpdating={false}
           state={null}
           error={null}
           fluidType={FluidType.ELECTRICITY}
@@ -36,7 +35,6 @@ describe('KonnectorModal component', () => {
       <Provider store={store}>
         <KonnectorModal
           open={true}
-          isUpdating={true}
           state={null}
           error={null}
           fluidType={FluidType.ELECTRICITY}
@@ -56,7 +54,6 @@ describe('KonnectorModal component', () => {
       <Provider store={store}>
         <KonnectorModal
           open={true}
-          isUpdating={false}
           state="errored"
           error={null}
           fluidType={FluidType.ELECTRICITY}
@@ -77,7 +74,6 @@ describe('KonnectorModal component', () => {
       <Provider store={store}>
         <KonnectorModal
           open={true}
-          isUpdating={false}
           state="error"
           error={KonnectorError.LOGIN_FAILED}
           fluidType={FluidType.ELECTRICITY}
@@ -97,7 +93,6 @@ describe('KonnectorModal component', () => {
       <Provider store={store}>
         <KonnectorModal
           open={true}
-          isUpdating={false}
           state="error"
           error={null}
           fluidType={FluidType.ELECTRICITY}
@@ -115,7 +110,6 @@ describe('KonnectorModal component', () => {
       <Provider store={store}>
         <KonnectorModal
           open={true}
-          isUpdating={true}
           state={null}
           error={null}
           fluidType={FluidType.WATER}
diff --git a/src/components/Konnector/KonnectorViewerCard.tsx b/src/components/Konnector/KonnectorViewerCard.tsx
index 9b9b622c1..f62cfcb32 100644
--- a/src/components/Konnector/KonnectorViewerCard.tsx
+++ b/src/components/Konnector/KonnectorViewerCard.tsx
@@ -299,7 +299,9 @@ const KonnectorViewerCard = ({
 
         /**
          * If waiting for consent, close Konnector modal first and handle connection closed
-         * Calling handleConnectionEnd because it won't be called in the KonnectorModal since we don't show it
+         * Calling handleConnectionEnd here because it won't be called in the KonnectorModal since we don't show it
+         *
+         * Else set error for KonnectorModal
          */
         if (
           fluidType === FluidType.GAS &&
@@ -307,7 +309,6 @@ const KonnectorViewerCard = ({
         ) {
           await handleConnectionEnd(false)
         } else {
-          // set error for KonnectorModal
           setKonnectorState(_state)
         }
       }
@@ -404,7 +405,6 @@ const KonnectorViewerCard = ({
         !isKonnectorRunning(trigger)
       ) {
         if (subscribed) {
-          // Open Konnector modal then set shouldLaunchKonnector to false
           setOpenModal(true)
           const updatedConnection: FluidConnection = {
             ...currentFluidStatus.connection,
-- 
GitLab