Skip to content

Commit

Permalink
fix(composables-next): access for the right active addresses (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucmus committed Oct 2, 2023
1 parent eb9648d commit 12ed75f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-buses-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/composables-next": patch
---

Correct active addresses location for current context
7 changes: 5 additions & 2 deletions packages/composables/src/useSessionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ export function useSessionContext(
};

const activeShippingAddress = computed(
() => sessionContext.value?.shippingLocation?.address || null,
() =>
sessionContext.value?.customer?.activeShippingAddress ||
sessionContext.value?.shippingLocation?.address ||
null,
);
const setActiveShippingAddress = async (
address: Partial<ShippingAddress>,
Expand All @@ -202,7 +205,7 @@ export function useSessionContext(

// TODO: replace the source from defaultBillingAddress by new value once NEXT-28627 is solved
const activeBillingAddress = computed(
() => sessionContext.value?.customer?.defaultBillingAddress || null,
() => sessionContext.value?.customer?.activeBillingAddress || null,
);
const setActiveBillingAddress = async (address: Partial<BillingAddress>) => {
if (!address?.id) {
Expand Down

2 comments on commit 12ed75f

@vercel
Copy link

@vercel vercel bot commented on 12ed75f Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

frontends-demo – ./templates/vue-demo-store

frontends-demo.vercel.app
frontends-demo-git-main-shopware-frontends.vercel.app
frontends-demo-shopware-frontends.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 12ed75f Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.