From 169a08158675d2cbaa1bfd0563be9cc08cdbd33e Mon Sep 17 00:00:00 2001 From: mkucmus Date: Wed, 15 Jan 2020 09:21:14 +0100 Subject: [PATCH] feat(theme): show list of all saved addresses. (#279) --- packages/composables/src/hooks/useUser.ts | 10 ++++++-- .../components/account/Address.vue | 10 ++++---- .../account/OrderHistory/OrderDetails.vue | 2 +- packages/default-theme/pages/account.vue | 23 ++++++++++++------- packages/shopware-6-client/src/index.ts | 2 ++ .../src/services/customerService.ts | 2 +- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/packages/composables/src/hooks/useUser.ts b/packages/composables/src/hooks/useUser.ts index 03450e5d4..01c4a4233 100644 --- a/packages/composables/src/hooks/useUser.ts +++ b/packages/composables/src/hooks/useUser.ts @@ -4,11 +4,13 @@ import { logout as apiLogout, getCustomer, getCustomerOrders, - getCustomerOrderDetails + getCustomerOrderDetails, + getCustomerAddresses } from "@shopware-pwa/shopware-6-client"; import { Customer } from "packages/shopware-6-client/src/interfaces/models/checkout/customer/Customer"; import { getStore } from "@shopware-pwa/composables"; import { Order } from "@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/order/Order"; +import { CustomerAddress } from "@shopware-pwa/shopware-6-client/src/interfaces/models/checkout/customer/CustomerAddress"; interface UseUser { login: ({ @@ -27,6 +29,7 @@ interface UseUser { logout: () => Promise; loadOrders: () => Promise; getOrderDetails: (orderId: string) => Promise; + getAddresses: () => Promise; } export const useUser = (): UseUser => { @@ -81,6 +84,8 @@ export const useUser = (): UseUser => { return getCustomerOrderDetails(orderId); }; + const getAddresses = (): Promise => getCustomerAddresses(); + const isLoggedIn = computed(() => !!user.value); return { @@ -93,6 +98,7 @@ export const useUser = (): UseUser => { logout, orders, loadOrders, - getOrderDetails + getOrderDetails, + getAddresses }; }; diff --git a/packages/default-theme/components/account/Address.vue b/packages/default-theme/components/account/Address.vue index a1b12d736..7c2eab293 100644 --- a/packages/default-theme/components/account/Address.vue +++ b/packages/default-theme/components/account/Address.vue @@ -1,7 +1,6 @@