From ed42631ef49ab93b21d6e30a9b2f9d094ca89f24 Mon Sep 17 00:00:00 2001 From: DuvCharles Date: Wed, 15 Nov 2023 09:09:40 +0100 Subject: [PATCH] :sparkles: get cart method --- lib/sylius/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/sylius/index.ts b/lib/sylius/index.ts index 3ac0dc8069..82c3bf4d34 100644 --- a/lib/sylius/index.ts +++ b/lib/sylius/index.ts @@ -159,9 +159,10 @@ export const createCart = async (): Promise => { return normalizeCart(syliusCart); }; -export const getCart = (cartId: string) => { - syliusRequest(REST_METHODS.GET, `/orders/${cartId}`); - return {}; +export const getCart = async (cartId: string): Promise => { + const data = await syliusRequest(REST_METHODS.GET, `/orders/${cartId}`); + const syliusCart = data.body; + return normalizeCart(syliusCart); }; export const addToCart = (cartId: string | undefined, payload: AddToCartPayload[]) => { syliusRequest(REST_METHODS.PUT, `/orders/${cartId}/items`, payload[0]);