diff --git a/src/components/Konnector/KonnectorViewerCard.tsx b/src/components/Konnector/KonnectorViewerCard.tsx index 828f8bcffe5dad24fd67ddb829253ca26c9b5873..e598bbdbf8442ba8067e40539290920655d4ded5 100644 --- a/src/components/Konnector/KonnectorViewerCard.tsx +++ b/src/components/Konnector/KonnectorViewerCard.tsx @@ -209,7 +209,6 @@ const KonnectorViewerCard = ({ } dispatch(setShowConnectionDetails(false)) setOpenModal(false) - // TODO null state seems to be read before modal closing and display a success icon in modal setKonnectorState(null) setKonnectorErrorDescription(null) }, @@ -294,16 +293,19 @@ const KonnectorViewerCard = ({ fluidConnection: updatedConnection, }) ) - Promise.all([ + const [, updatedFluidStatus] = await Promise.all([ await refreshChallengeState(), await updateGlobalFluidStatus(), ]) setKonnectorState(_state) - /** If waiting for consent, close Konnector modal */ - if (isWaitingForConsent) { + /** If waiting for consent, close Konnector modal first and handle connection closed */ + if ( + updatedFluidStatus[2].connection.triggerState?.last_error === + KonnectorError.CHALLENGE_ASKED + ) { setOpenModal(false) - setKonnectorState(null) + handleConnectionEnd(false) } } }, @@ -311,7 +313,7 @@ const KonnectorViewerCard = ({ currentFluidStatus.connection, currentFluidStatus.fluidType, dispatch, - isWaitingForConsent, + handleConnectionEnd, refreshChallengeState, updateGlobalFluidStatus, ] diff --git a/src/services/fluid.service.ts b/src/services/fluid.service.ts index 2d4a24fc310b6cba29247ddaf93fff4cd9fcf0b8..25a5b9ad0e15935e4bf4cfe938daa8ace3f19d1b 100644 --- a/src/services/fluid.service.ts +++ b/src/services/fluid.service.ts @@ -19,7 +19,6 @@ export default class FluidService { konnector: Konnector | null, state: TriggerState | null ): FluidState => { - console.log('🚀 ~ FluidService ~ state:', state) if (!konnector) return FluidState.KONNECTOR_NOT_FOUND if (!state) return FluidState.NOT_CONNECTED switch (state.status) {