Skip to content

Commit

Permalink
FORM-426: Fix profile correspondent address (#131)
Browse files Browse the repository at this point in the history
FORM-426

fix profile correspondent address
  • Loading branch information
AntonZezul authored Apr 3, 2023
1 parent fbe0a07 commit b9302d9
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ interface UserProfileDetailViewProps {

const UserProfileDetailView = ({ userData }: UserProfileDetailViewProps) => {
const { t } = useTranslation('account')
const postalCodeFormat = (code: string): string => `${code?.slice(0, 3)} ${code?.slice(3)}`
const { given_name, family_name, email, phone_number, address } = userData
const fullName = `${given_name ?? ''} ${family_name ?? ''}`
const fullAddress = `${address?.street_address ?? ''}${
address?.street_address && (address?.locality || address?.postal_code) ? ', ' : ''
}${address?.locality}${address?.locality && address?.postal_code ? ' ' : ''}${
address?.postal_code ?? ''
}`
const fullAddress = address
? address.street_address || address.postal_code || address.locality
? `${
address?.street_address && (address?.postal_code || address?.locality)
? `${address?.street_address},`
: address?.street_address
} ${postalCodeFormat(address?.postal_code)} ${address?.locality}`
: ''
: ''
return (
<div className="flex flex-col grow gap-6">
{/* <UserProfileDetailViewRow label={t('profile_detail.titles_before_name')} /> */}
Expand Down

0 comments on commit b9302d9

Please sign in to comment.