Vue Storefront is now Alokai! Learn More
GetOrderDetails

GetOrderDetails

Implements GetOrderDetails Unified Method.

Source

import { getNormalizers } from "@vsf-enterprise/unified-api-sapcc/udl";
import { defineApi } from "@vsf-enterprise/unified-api-sapcc";


declare module "@vsf-enterprise/unified-api-sapcc" {
  interface GetOrderDetailsExtendedArgs {
    /**
     * Response configuration. List of fields returned in the response body.
     */
    fields?: "BASIC" | "DEFAULT" | "FULL" | string | string[];
  }
}


export const getOrderDetails = defineApi.getOrderDetails(async (context, args) => {
  const { id } = args;
  const { data } = await context.api.getUserOrders({ code: id });
  const { normalizeOrder } = getNormalizers(context);

  return normalizeOrder(data);
});