Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dispatch, FC, SetStateAction, useMemo, useState } from 'react'
import { bind, trim } from 'lodash'
import { bind, omit, trim } from 'lodash'
import { toast } from 'react-toastify'

import { BaseModal, Button, InputSelect, InputText } from '~/libs/ui'
Expand All @@ -18,6 +18,10 @@ interface ModifyLocationModalProps {
profile: UserProfile
}

const OMIT_ADDRESS_KEYS_ON_UPDATE = [
'createdAt', 'createdBy', 'updatedAt', 'updatedBy',
]

const ModifyLocationModal: FC<ModifyLocationModalProps> = (props: ModifyLocationModalProps) => {
const countryLookup: CountryLookup[] | undefined
= useCountryLookup()
Expand Down Expand Up @@ -59,7 +63,7 @@ const ModifyLocationModal: FC<ModifyLocationModalProps> = (props: ModifyLocation
props.profile.handle,
{
addresses: [{
...props.profile.addresses ? props.profile.addresses[0] : {},
...props.profile.addresses ? omit(props.profile.addresses[0], OMIT_ADDRESS_KEYS_ON_UPDATE) : {},
city: trim(formValues.city),
}],
competitionCountryCode: formValues.country,
Expand Down