Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Fix cache on cart
Browse files Browse the repository at this point in the history
  • Loading branch information
typeofweb committed May 8, 2023
1 parent f3ecbfd commit 664b57b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/saleor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ export async function getCart(cartId: string): Promise<Cart | null> {
query: GetCheckoutByIdDocument,
variables: {
id: cartId
}
},
cache: 'no-store'
});

if (!saleorCheckout.checkout) {
Expand All @@ -345,7 +346,8 @@ export async function createCart(): Promise<Cart> {
channel: 'default-channel',
lines: []
}
}
},
cache: 'no-store'
});

if (!saleorCheckout.checkoutCreate?.checkout) {
Expand All @@ -365,7 +367,8 @@ export async function addToCart(
variables: {
checkoutId: cartId,
lines: lines.map(({ merchandiseId, quantity }) => ({ variantId: merchandiseId, quantity }))
}
},
cache: 'no-store'
});

if (!saleorCheckout.checkoutLinesAdd?.checkout) {
Expand All @@ -385,7 +388,8 @@ export async function updateCart(
variables: {
checkoutId: cartId,
lines: lines.map(({ id, quantity }) => ({ lineId: id, quantity }))
}
},
cache: 'no-store'
});

if (!saleorCheckout.checkoutLinesUpdate?.checkout) {
Expand All @@ -402,7 +406,8 @@ export async function removeFromCart(cartId: string, lineIds: string[]): Promise
variables: {
checkoutId: cartId,
lineIds
}
},
cache: 'no-store'
});

if (!saleorCheckout.checkoutLinesDelete?.checkout) {
Expand Down

1 comment on commit 664b57b

@vercel
Copy link

@vercel vercel bot commented on 664b57b May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.