Skip to content

Commit

Permalink
✨ get cart method
Browse files Browse the repository at this point in the history
  • Loading branch information
DuvCharles committed Nov 21, 2023
1 parent de3a0ed commit ed42631
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/sylius/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ export const createCart = async (): Promise<Cart> => {

return normalizeCart(syliusCart);
};
export const getCart = (cartId: string) => {
syliusRequest(REST_METHODS.GET, `/orders/${cartId}`);
return {};
export const getCart = async (cartId: string): Promise<Cart> => {
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]);
Expand Down

0 comments on commit ed42631

Please sign in to comment.