diff --git a/src/components/Connection/EPGLConnect/EpglForm.tsx b/src/components/Connection/EPGLConnect/EpglForm.tsx index 0ae8fc6a35f01ddadba355bd9d378ed27f144112..26719ef2e42edd164b70d370b12edec111ed69fc 100644 --- a/src/components/Connection/EPGLConnect/EpglForm.tsx +++ b/src/components/Connection/EPGLConnect/EpglForm.tsx @@ -29,7 +29,7 @@ const EpglForm = ({ hasCreatedAccount }: { hasCreatedAccount: boolean }) => { const [loading, setLoading] = useState<boolean>(false) const [showPassword, setShowPassword] = useState(false) - const [connect, update, connectError] = useKonnectorAuth(FluidType.WATER, { + const [connect, update] = useKonnectorAuth(FluidType.WATER, { eglAuthData: { login, password }, }) @@ -67,10 +67,6 @@ const EpglForm = ({ hasCreatedAccount }: { hasCreatedAccount: boolean }) => { } } - useEffect(() => { - if (connectError) setError(connectError) - }, [connectError]) - useEffect(() => { if (account?.auth) { const auth = account.auth diff --git a/src/components/Hooks/useKonnectorAuth.tsx b/src/components/Hooks/useKonnectorAuth.tsx index 150ab18e3e73103b3a8d35112253fcce04279cfb..b99c909db7959310b6758d9d7aaac00fcc060d31 100644 --- a/src/components/Hooks/useKonnectorAuth.tsx +++ b/src/components/Hooks/useKonnectorAuth.tsx @@ -1,6 +1,5 @@ import * as Sentry from '@sentry/react' import { useClient } from 'cozy-client' -import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { FluidType } from 'enums' import { AccountEGLData, @@ -9,7 +8,6 @@ import { FluidConnection, SgeStore, } from 'models' -import { useState } from 'react' import AccountService from 'services/account.service' import ConnectionService from 'services/connection.service' import { updateFluidConnection } from 'store/global/global.slice' @@ -67,14 +65,12 @@ const useKonnectorAuth = ( sgeAuthData?: SgeStore grdfAuthData?: AccountGRDFData } -): [() => Promise<null | undefined>, () => Promise<void>, string] => { +): [() => Promise<null | undefined>, () => Promise<void>] => { const client = useClient() - const { t } = useI18n() const dispatch = useAppDispatch() const { fluidStatus } = useAppSelector(state => state.ecolyo.global) const currentFluidStatus = fluidStatus[fluidType] const konnectorSlug = currentFluidStatus.connection.konnectorConfig.slug - const [connectError, setConnectError] = useState<string>('') const connect = async () => { try { @@ -93,7 +89,6 @@ const useKonnectorAuth = ( ) if (!trigger || !account) { - setConnectError(t('konnector_form.error_account_creation')) return null } const updatedConnection: FluidConnection = { @@ -148,7 +143,7 @@ const useKonnectorAuth = ( Sentry.captureException(error) } } - return [connect, update, connectError] + return [connect, update] } export default useKonnectorAuth diff --git a/src/locales/fr.json b/src/locales/fr.json index 27bff7a7a136d240954126d5451898549a5c0456..9fa6b95a7b4337c81dbd5f57bb756097fab886ee 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -760,7 +760,6 @@ "login_failed": "Un problème a lieu lors de la récupération de vos données. Merci de supprimer votre connecteur et vous reconnecter.", "not_installed": "Le connecteur n'est pas installé. Veuillez l'installer en cliquant sur le bouton ci-dessous.", "button_install": "Installer", - "error_account_creation": "Une erreur est survenue, veuillez essayer de nouveau.", "error_no_login_password": "Identifiant et mot de passe requis", "error_login_failed": "Identifiants invalides", "error_update": "Un problème est survenu lors du rapatriement de vos données.",