fix stripe payment flow

This commit is contained in:
2026-04-09 22:52:57 -06:00
parent 1010d57b79
commit 39e4a3896e
8 changed files with 66 additions and 40 deletions

View File

@@ -124,16 +124,10 @@ export function CartProvider({ children }) {
);
const checkout = useCallback(
async (paymentMethodId) => {
async () => {
if (!token || !selectedStoreId) throw new Error("Select a store first");
const result = await apiCheckout(token, {
storeId: selectedStoreId,
paymentMethodId,
});
if (result?.status === "succeeded") {
setCart(null);
}
const result = await apiCheckout(token, { storeId: selectedStoreId });
return result;
},
[token, selectedStoreId]