Skip to content

Commit

Permalink
fix(composables): create address flow (SWF-245)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanilowicz authored and patzick committed Jan 24, 2023
1 parent cf78d81 commit f364da4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-apricots-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/composables-next": patch
---

Remove setting default address in createCustomerAddress function
6 changes: 0 additions & 6 deletions packages/composables/src/useAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ export function useAddress(): UseAddressReturn {
): Promise<CustomerAddress> {
const result = await apiCreateCustomerAddress(customerAddress, apiInstance);
await loadCustomerAddresses();
if (isGuestSession.value) {
return result;
}

await setDefaultCustomerBillingAddress(result.id);
await setDefaultCustomerShippingAddress(result.id);
return result;
}

Expand Down
4 changes: 4 additions & 0 deletions templates/vue-demo-store/pages/checkout/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const selectedShippingAddress = computed({
async set(shippingAddressId: string) {
isLoading[`shipping-${shippingAddressId}`] = true;
await setActiveShippingAddress({ id: shippingAddressId });
if (shippingAddressId === selectedBillingAddress.value)
state.customShipping = false;
isLoading[`shipping-${shippingAddressId}`] = false;
},
});
Expand All @@ -79,6 +81,8 @@ const selectedBillingAddress = computed({
async set(billingAddressId: string) {
isLoading[`billing-${billingAddressId}`] = true;
await setActiveBillingAddress({ id: billingAddressId });
if (billingAddressId === selectedShippingAddress.value)
state.customShipping = false;
isLoading[`billing-${billingAddressId}`] = false;
},
});
Expand Down

0 comments on commit f364da4

Please sign in to comment.