fix stripe payment flow
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user