Skip to content

Commit

Permalink
fix: show address lists by type in quote draft
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlLiu2023 authored and BrianJiang2021 committed Jul 11, 2023
1 parent 6ad6df6 commit bea15d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/storefront/src/pages/quote/components/ChooseAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface ChooseAddressProps {
addressList: AddressItemProps[]
closeModal: () => void
handleChangeAddress: (address: AddressItemType) => void
type: string
}

interface RefProps {
Expand All @@ -28,6 +29,7 @@ function ChooseAddress({
closeModal,
handleChangeAddress,
addressList = [],
type,
}: ChooseAddressProps) {
const recordList = useRef<RefProps>({
copyList: [],
Expand All @@ -37,7 +39,12 @@ function ChooseAddress({

useEffect(() => {
if (addressList.length) {
const newList = addressList.map((item: AddressItemProps) => item.node)
const allList = addressList.map((item: AddressItemProps) => item.node)
const newList = allList.filter(
(item) =>
(item.isShipping === 1 && type === 'shipping') ||
(item.isBilling === 1 && type === 'billing')
)
recordList.current.copyList = newList
setList(newList)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ function QuoteAddress(
handleChangeAddress={handleChangeAddress}
closeModal={handleCloseAddressChoose}
addressList={addressList}
type={type}
/>
</Box>
)
Expand Down

0 comments on commit bea15d8

Please sign in to comment.