Skip to content

Commit

Permalink
fix: bc address issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and b3aton committed Dec 2, 2022
1 parent 2ebdd2a commit 003bff7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/storefront/src/pages/address/components/AddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const AddressForm = ({
currentCountryName = countryName

if (states.length > 0) {
const state = states.filter((item: StateProps) => item.stateCode === currentStateCode)[0]
const state = states.filter((item: StateProps) => item.stateCode === currentStateCode || item.stateName === currentStateCode)[0]

currentStateName = state.stateName || currentStateCode
currentStateCode = state.stateCode || currentStateCode
Expand Down Expand Up @@ -268,6 +268,7 @@ const AddressForm = ({
const handleSaveBcAddress = (event: BaseSyntheticEvent<object, any, any> | undefined) => {
handleSubmit(async (data) => {
setAddUpdateLoading(true)

try {
const extraFields = addressExtraFields.map((field: CustomFieldItems) => ({
name: field.bcLabel,
Expand All @@ -293,7 +294,8 @@ const AddressForm = ({
currentCountryName = countryName

if (states.length > 0) {
const state = states.filter((item: StateProps) => item.stateCode === currentStateCode)[0]
const state = states.filter((item: StateProps) => item.stateCode === currentStateCode || item.stateName === currentStateCode)[0]

currentStateName = state.stateName || currentStateCode
currentStateCode = state.stateCode || currentStateCode
} else {
Expand Down

0 comments on commit 003bff7

Please sign in to comment.