ok banget
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user