Skip to content

Commit 67b116c

Browse files
made a successfull purchase reload the page to update transactions and user balance
1 parent a93c097 commit 67b116c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/contexts/CartContext.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { createContext, useState, useContext, ReactNode, useEffect } from 'react';
22
import transactionsApi from '../api/transactionsApi';
33

4+
45
interface CartContextType {
56
itemsInCart: ProductInCart[];
67
numberOfProductsInCart: number;
@@ -85,9 +86,9 @@ export const CartProvider: React.FC<{ children: ReactNode }> = ({ children }) =>
8586
const success = await transactionsApi.makePurchase(payingUserid, itemsInCart, comment);
8687
if (success) {
8788
clearOrder();
88-
return true;
89+
window.location.reload();
8990
}
90-
else return false;
91+
return false;
9192
}
9293

9394

src/pages/transactionsPage/TransactionsPage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
.transaction-preview-content>div {
6161
display: flex;
62-
align-items: center;
62+
align-items: flex-start;
6363
justify-content: space-between;
6464
gap: .5rem;
6565
}

0 commit comments

Comments
 (0)