ok banget

This commit is contained in:
zadit
2024-10-30 03:32:48 +07:00
parent 1ecc6db645
commit 5a2b9b2f86
18 changed files with 244 additions and 130 deletions

View File

@@ -4,9 +4,9 @@ import { useParams } from "react-router-dom";
import { ColorRing } from "react-loader-spinner";
import {
getMyTransactions,
getTransactions,
confirmTransaction,
declineTransaction,
getTransactionsFromCafe,
} from "../helpers/transactionHelpers";
import { getTables } from "../helpers/tableHelper";
import TableCanvas from "../components/TableCanvas";
@@ -18,17 +18,17 @@ export default function Transactions({ propsShopId, sendParam, deviceType }) {
const [tables, setTables] = useState([]);
const [selectedTable, setSelectedTable] = useState(null);
const [transactions, setTransactions] = useState([]);
const [myTransactions, setMyTransactions] = useState([]);
const [isPaymentLoading, setIsPaymentLoading] = useState(false);
useEffect(() => {
const fetchTransactions = async () => {
try {
let response;
if (deviceType == "clerk")
response = await getTransactions(shopId || propsShopId, 5);
else if (deviceType == "guestDevice")
response = await getTransactionsFromCafe(shopId || propsShopId, 5);
setTransactions(response);
response = await getMyTransactions(shopId || propsShopId, 5);
setTransactions(response);
setMyTransactions(response);
} catch (error) {
console.error("Error fetching transactions:", error);
}