fix: cart payment
This commit is contained in:
parent
4cd7ae14a6
commit
d07acf57fd
@ -14,9 +14,14 @@ export const useAfterpay = () => {
|
||||
|
||||
const checkPayment = () => {
|
||||
const redirectUrl = new URL(window.location.href);
|
||||
const paymentUserId = redirectUrl.searchParams.get("userid");
|
||||
redirectUrl.searchParams.set("afterpay", "false");
|
||||
navigate(redirectUrl);
|
||||
|
||||
if (userId !== paymentUserId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const payCartPendingRequestDeadline = localStorage.getItem(
|
||||
"payCartPendingRequestDeadline",
|
||||
);
|
||||
@ -50,14 +55,15 @@ export const useAfterpay = () => {
|
||||
};
|
||||
|
||||
const checkParams = () => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const afterpay = params.get("afterpay");
|
||||
const paymentUserId = params.get("userid");
|
||||
const afterpay = new URLSearchParams(window.location.search).get(
|
||||
"afterpay",
|
||||
);
|
||||
|
||||
if (afterpay && userId === paymentUserId) {
|
||||
if (afterpay) {
|
||||
checkPayment();
|
||||
}
|
||||
};
|
||||
|
||||
setInterval(checkParams, 5000);
|
||||
checkParams();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user