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

change to lowercase

parent ad76c651
No related branches found
No related tags found
1 merge request!1253feat(forms): re-use user values
......@@ -86,8 +86,8 @@ const SgeConnectView = () => {
switch (currentStep) {
case SgeStep.IdentityAndPDL:
return (
sgeState.firstName !== '' &&
sgeState.lastName !== '' &&
sgeState.firstname !== '' &&
sgeState.lastname !== '' &&
sgeState.pdl !== null &&
sgeState.pdl.toString().length === 14
)
......@@ -107,8 +107,8 @@ const SgeConnectView = () => {
sgeState.address,
sgeState.city,
sgeState.dataConsent,
sgeState.firstName,
sgeState.lastName,
sgeState.firstname,
sgeState.lastname,
sgeState.pdl,
sgeState.pdlConfirm,
sgeState.zipCode,
......@@ -122,8 +122,8 @@ const SgeConnectView = () => {
client.save({
...formData,
_type: FORM_DOCTYPE,
firstName: sgeState.firstName,
lastName: sgeState.lastName,
firstName: sgeState.firstname,
lastName: sgeState.lastname,
pdl: sgeState.pdl,
address: sgeState.address,
city: sgeState.city,
......
......@@ -61,8 +61,8 @@ describe('StepIdentityAndPdl component', () => {
sgeState={{
...mockSgeState,
pdl: 11111111111111,
firstName: 'Zack',
lastName: 'Ichan',
firstname: 'Zack',
lastname: 'Ichan',
zipCode: 69003,
}}
onChange={mockHandleChange}
......
......@@ -31,7 +31,7 @@ const StepIdentityAndPdl = ({
variant="outlined"
type="text"
id="firstName"
value={sgeState.firstName}
value={sgeState.firstname}
onChange={e => onChange('firstName', e.target.value)}
required
autoComplete="given-name"
......@@ -41,7 +41,7 @@ const StepIdentityAndPdl = ({
variant="outlined"
type="text"
id="lastName"
value={sgeState.lastName}
value={sgeState.lastname}
onChange={e => onChange('lastName', e.target.value)}
required
autoComplete="family-name"
......
......@@ -45,8 +45,8 @@ export const useFormData = () => {
export const createInitialSgeState = (formData?: FormData): SgeStore => ({
address: formData?.address ?? '',
lastName: formData?.lastName ?? '',
firstName: formData?.firstName ?? '',
lastname: formData?.lastName ?? '',
firstname: formData?.firstName ?? '',
pdl: formData?.pdl ? parseInt(formData.pdl) : null,
zipCode: formData?.zipCode ? parseInt(formData.zipCode) : null,
city: formData?.city ?? '',
......
......@@ -47,8 +47,8 @@ const formatAuthData = ({
} else if (sgeAuthData) {
const konnectorFields: AccountSgeData = {
pointId: sgeAuthData?.pdl?.toString() ?? '',
firstname: sgeAuthData?.firstName ?? '',
lastname: sgeAuthData?.lastName ?? '',
firstname: sgeAuthData?.firstname ?? '',
lastname: sgeAuthData?.lastname ?? '',
address: sgeAuthData?.address ?? '',
postalCode: sgeAuthData?.zipCode?.toString() ?? '',
city: sgeAuthData?.city ?? '',
......
......@@ -6,7 +6,7 @@ import { useClient } from 'cozy-client'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
import { FluidType, KonnectorUpdate } from 'enums'
import { DateTime } from 'luxon'
import { AccountSgeData, FluidConnection, FluidStatus } from 'models'
import { FluidConnection, FluidStatus } from 'models'
import React, { useCallback, useEffect, useState } from 'react'
import AccountService from 'services/account.service'
import DateChartService from 'services/dateChart.service'
......@@ -14,7 +14,6 @@ import TriggerService from 'services/triggers.service'
import {
setShouldRefreshConsent,
updateFluidConnection,
updateSgeStore,
} from 'store/global/global.slice'
import { useAppDispatch, useAppSelector } from 'store/hooks'
import { getKonnectorUpdateError } from 'utils/utils'
......@@ -108,33 +107,11 @@ const ConnectionResult = ({
const handleRefreshConsent = useCallback(() => {
if (fluidType == FluidType.ELECTRICITY) {
const accountData = currentFluidStatus.connection.account
?.auth as AccountSgeData
// store the previous account data since the onDelete will remove account from DB
dispatch(
updateSgeStore({
currentStep: 0,
firstName: accountData.firstname,
lastName: accountData.lastname,
pdl: parseInt(accountData.pointId),
address: accountData.address,
zipCode: parseInt(accountData.postalCode),
city: accountData.city,
dataConsent: true,
pdlConfirm: true,
shouldLaunchAccount: true,
})
)
dispatch(setShouldRefreshConsent(true))
} else {
deleteAccountsAndTriggers()
}
}, [
fluidType,
currentFluidStatus.connection.account?.auth,
dispatch,
deleteAccountsAndTriggers,
])
}, [fluidType, dispatch, deleteAccountsAndTriggers])
useEffect(() => {
if (currentFluidStatus.connection.triggerState?.last_success) {
......
export interface SgeStore {
currentStep: number
firstName: string
lastName: string
firstname: string
lastname: string
pdl: number | null
address: string
zipCode: number | null
......
......@@ -2,8 +2,8 @@ import { SgeStore } from 'models'
export const mockSgeState: SgeStore = {
address: '',
lastName: '',
firstName: '',
lastname: '',
firstname: '',
pdl: 0,
zipCode: 0,
city: '',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment