Skip to content

Commit

Permalink
fix: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamv-ss committed Nov 29, 2024
1 parent 8471463 commit d3d9892
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions src/components/CompanyData/Identiifier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
import React, { useEffect } from 'react';
import { Row } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { UniqueIdentifier } from 'state/features/application/applicationApiSlice';
import { Patterns } from 'types/Patterns';
import React, { useEffect } from 'react'
import { Row } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import { UniqueIdentifier } from 'state/features/application/applicationApiSlice'
import { Patterns } from 'types/Patterns'

interface IdentifierFormProps {
uniqueIds: { type: string; value: string }[]
Expand All @@ -44,41 +44,41 @@ export const IdentifierForm: React.FC<IdentifierFormProps> = ({
identifierType,
identifierNumber,
errors,
identifierDetails,
identifierDetails,
country,
onIdentifierTypeChange,
setIdentifierNumber,
setChangedCountryValue,
setErrors,
handleIdentifierSelect,
}) => {
const { t } = useTranslation();
const { t } = useTranslation()

const validateIdentifierNumber = (value) => {
setChangedCountryValue(false)
setIdentifierNumber(value)
const countryCode = ['DE', 'FR', 'IN', 'MX'].includes(country)
? country
: 'Worldwide'
if (
identifierType &&
!Patterns[countryCode][identifierType].test(value?.trim())
) {
setErrors((prevState) => ({
...prevState,
identifierNumber: `${countryCode}_${identifierType}`,
}))
} else {
setErrors((prevState) => ({ ...prevState, identifierNumber: '' }))
}
}
const validateIdentifierNumber = (value) => {
setChangedCountryValue(false)
setIdentifierNumber(value)
const countryCode = ['DE', 'FR', 'IN', 'MX'].includes(country)
? country
: 'Worldwide'
if (
identifierType &&
!Patterns[countryCode][identifierType].test(value?.trim())
) {
setErrors((prevState) => ({
...prevState,
identifierNumber: `${countryCode}_${identifierType}`,
}))
} else {
setErrors((prevState) => ({ ...prevState, identifierNumber: '' }))
}
}

useEffect(() => {
identifierNumber &&
identifierType &&
validateIdentifierNumber(identifierNumber)
}, [identifierType, identifierNumber])

useEffect(() => {
identifierNumber &&
identifierType &&
validateIdentifierNumber(identifierNumber)
}, [identifierType, identifierNumber])

return (
<>
{uniqueIds && uniqueIds?.length > 1 ? (
Expand Down Expand Up @@ -178,4 +178,4 @@ export const IdentifierForm: React.FC<IdentifierFormProps> = ({
)}
</>
)
};
}

0 comments on commit d3d9892

Please sign in to comment.