ok
This commit is contained in:
@@ -38,12 +38,24 @@ export default function Transactions({
|
||||
try {
|
||||
const fetchedTransaction = await getTransaction(transactionId);
|
||||
setTransaction(fetchedTransaction);
|
||||
console.log(transaction);
|
||||
console.log(fetchedTransaction); // Log the fetched transaction
|
||||
} catch (error) {
|
||||
console.error("Error fetching transaction:", error);
|
||||
}
|
||||
};
|
||||
fetchData();
|
||||
|
||||
const waitForLocalStorage = async () => {
|
||||
while (localStorage.getItem("auth") === null) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait 1 second
|
||||
}
|
||||
};
|
||||
|
||||
const initialize = async () => {
|
||||
await waitForLocalStorage();
|
||||
await fetchData();
|
||||
};
|
||||
|
||||
initialize();
|
||||
}, [searchParams]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -189,14 +201,17 @@ export default function Transactions({
|
||||
price={
|
||||
"Rp" + calculateTotalPrice(transaction.DetailedTransactions)
|
||||
}
|
||||
disabled={isPaymentLoading}
|
||||
disabled={transaction.payment_type == 'cash' || isPaymentLoading}
|
||||
isPaymentLoading={isPaymentLoading}
|
||||
handleClick={() => handleConfirm(transaction.transactionId)}
|
||||
Open={() => setIsPaymentOpen(true)}
|
||||
isPaymentOpen={isPaymentOpen}
|
||||
>
|
||||
{isPaymentLoading ? (
|
||||
{transaction.payment_type == 'cash' || isPaymentLoading ? (
|
||||
<>
|
||||
{transaction.payment_type == 'cash' && <p>tunggu konfirmasi</p>}
|
||||
<ColorRing height="50" width="50" color="white" />
|
||||
</>
|
||||
) : isPaymentOpen ? (
|
||||
"Claim has paid" // Display "Confirm has paid" if the transaction is confirmed (1)
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user