The Vue Storefront Essentials Course is now available! Learn More
GetCart

GetCart

Implements GetCart Unified Method.

Source

import { defineApi, getCartFromContext, getNormalizerContext } from "@vsf-enterprise/unified-api-sapcc";
import { getNormalizers } from "@vue-storefront/unified-data-model";

export const getCart = defineApi.getCart(async (context, args) => {
  const data = await getCartFromContext(context, args);
  const { normalizeCart } = getNormalizers(context);

  return normalizeCart(data, getNormalizerContext(context));
});