Skip to content
Snippets Groups Projects
Commit 9b16a282 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

revert some changes

parent 8a5e80df
No related branches found
No related tags found
1 merge request!1010chore(gas): small refactor
This commit is part of merge request !1010. Comments created here will be created in the context of that merge request.
import { Button, Dialog, IconButton } from '@material-ui/core'
import CloseIcon from 'assets/icons/ico/close.svg'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import { useClient } from 'cozy-client'
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
import { FluidType } from 'enums'
import { Konnector } from 'models'
import React, { useEffect, useState } from 'react'
import { useAppDispatch, useAppSelector } from 'store/hooks'
import './PartnerConnectModal.scss'
import { StepContent } from './StepContent.interface'
import GrdfCreateAccount from './Steps/GrdfCreateAccount'
......@@ -37,13 +33,7 @@ const GrdfConnectModal = ({
handleSuccess,
}: GrdfConnectModalProps) => {
const { t } = useI18n()
const client = useClient()
const dispatch = useAppDispatch()
const { fluidStatus } = useAppSelector(state => state.ecolyo.global)
const [currentStep, setCurrentStep] = useState(StepEnum.DoYouHaveAccount)
const [launchModal, setLaunchModal] = useState(false)
const currentFluidStatus = fluidStatus[FluidType.GAS]
const konnector: Konnector | null = currentFluidStatus.connection.konnector
useEffect(() => {
if (open) {
......
......
import Button from '@material-ui/core/Button'
import { useClient } from 'cozy-client'
import { OAuthWindow } from 'cozy-harvest-lib/dist/components/OAuthWindow'
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
import { FluidType } from 'enums'
import { Konnector } from 'models'
......@@ -40,7 +41,7 @@ const GrdfFormOAuth = ({
useEffect(() => {
if (shouldRefreshConsent) {
// If user has selected accept button on Expired consent modal, his account has been deleted on KonnectorViewerCard, such as his consent (for GRDF), then automatically launch oauth connection flow
setStatus(WAITING)
setStatus('waiting')
}
}, [shouldRefreshConsent])
......@@ -52,7 +53,7 @@ const GrdfFormOAuth = ({
<>
<Button
aria-label={t('auth.accessibility.button_connect')}
onClick={() => setStatus(WAITING)}
onClick={() => setStatus('waiting')}
disabled={isWaiting}
className="btnPrimary"
>
......@@ -60,6 +61,16 @@ const GrdfFormOAuth = ({
? t('auth.connect_oauth.loading')
: t('auth.button_validate')}
</Button>
{isWaiting && (
<OAuthWindow
client={client}
konnector={konnector}
redirectSlug={client.appMetadata.slug}
onSuccess={handleAccountId}
onCancel={endOAuth}
t={t}
/>
)}
</>
)
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment