GetCustomerAddresses
Implements GetCustomerAddresses
Unified Method.
Source
import { defineApi, getCurrentCustomer } from "@vsf-enterprise/unified-api-commercetools";
import { getNormalizers } from "@vsf-enterprise/unified-api-commercetools/udl";
export const getCustomerAddresses = defineApi.getCustomerAddresses(async (context) => {
const customer = await getCurrentCustomer(context);
const { normalizeCustomerAddress } = getNormalizers(context);
return {
addresses: customer.shippingAddresses.map((address) => normalizeCustomerAddress(address)),
};
});