GetCustomerAddresses
Implements GetCustomerAddresses
Unified Method.
Source
import { defineApi, getCurrentCustomer } from "@vsf-enterprise/unified-api-sfcc";
import { getNormalizers } from "@vsf-enterprise/unified-api-sfcc/udl";
declare module "@vsf-enterprise/unified-api-sfcc" {
interface GetCustomerAddressesExtendedArgs {}
}
export const getCustomerAddresses = defineApi.getCustomerAddresses(async (context) => {
const { addresses = [] } = await getCurrentCustomer(context);
const { normalizeCustomerAddress } = getNormalizers(context);
return {
addresses: addresses?.map((address) => normalizeCustomerAddress(address)),
};
});