mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-17 13:51:10 -05:00
🐛 fix(payment): Replace window.open with window.location.href for checkout links
This commit is contained in:
parent
39e89bfef5
commit
1d8c765c14
@ -175,15 +175,9 @@ export default function Page() {
|
|||||||
<div className='flex gap-4'>
|
<div className='flex gap-4'>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const width = 600;
|
if (payment?.checkout_url) {
|
||||||
const height = 800;
|
window.location.href = payment?.checkout_url;
|
||||||
const left = (screen.width - width) / 2;
|
}
|
||||||
const top = (screen.height - height) / 2;
|
|
||||||
window.open(
|
|
||||||
payment?.checkout_url,
|
|
||||||
'newWindow',
|
|
||||||
`width=${width},height=${height},top=${top},left=${left},menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1`,
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('goToPayment')}
|
{t('goToPayment')}
|
||||||
|
|||||||
@ -75,15 +75,7 @@ export default function Purchase({ subscribe, setSubscribe }: Readonly<PurchaseP
|
|||||||
const type = data.data?.type;
|
const type = data.data?.type;
|
||||||
const checkout_url = data.data?.checkout_url;
|
const checkout_url = data.data?.checkout_url;
|
||||||
if (type === 'link') {
|
if (type === 'link') {
|
||||||
const width = 600;
|
window.location.href = checkout_url!;
|
||||||
const height = 800;
|
|
||||||
const left = (screen.width - width) / 2;
|
|
||||||
const top = (screen.height - height) / 2;
|
|
||||||
window.open(
|
|
||||||
checkout_url,
|
|
||||||
'newWindow',
|
|
||||||
`width=${width},height=${height},top=${top},left=${left},menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
getUserInfo();
|
getUserInfo();
|
||||||
router.push(`/payment?order_no=${orderNo}`);
|
router.push(`/payment?order_no=${orderNo}`);
|
||||||
|
|||||||
@ -139,15 +139,7 @@ export default function Recharge(props: Readonly<ButtonProps>) {
|
|||||||
const type = data.data?.type;
|
const type = data.data?.type;
|
||||||
const checkout_url = data.data?.checkout_url;
|
const checkout_url = data.data?.checkout_url;
|
||||||
if (type === 'link') {
|
if (type === 'link') {
|
||||||
const width = 600;
|
window.location.href = checkout_url!;
|
||||||
const height = 800;
|
|
||||||
const left = (screen.width - width) / 2;
|
|
||||||
const top = (screen.height - height) / 2;
|
|
||||||
window.open(
|
|
||||||
checkout_url,
|
|
||||||
'newWindow',
|
|
||||||
`width=${width},height=${height},top=${top},left=${left},menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
router.push(`/payment?order_no=${orderNo}`);
|
router.push(`/payment?order_no=${orderNo}`);
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
|||||||
@ -83,15 +83,7 @@ export default function Renewal({ id, subscribe }: Readonly<RenewalProps>) {
|
|||||||
const type = data.data?.type;
|
const type = data.data?.type;
|
||||||
const checkout_url = data.data?.checkout_url;
|
const checkout_url = data.data?.checkout_url;
|
||||||
if (type === 'link') {
|
if (type === 'link') {
|
||||||
const width = 600;
|
window.location.href = checkout_url!;
|
||||||
const height = 800;
|
|
||||||
const left = (screen.width - width) / 2;
|
|
||||||
const top = (screen.height - height) / 2;
|
|
||||||
window.open(
|
|
||||||
checkout_url,
|
|
||||||
'newWindow',
|
|
||||||
`width=${width},height=${height},top=${top},left=${left},menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
getUserInfo();
|
getUserInfo();
|
||||||
router.push(`/payment?order_no=${orderNo}`);
|
router.push(`/payment?order_no=${orderNo}`);
|
||||||
|
|||||||
@ -90,15 +90,7 @@ export default function ResetTraffic({ id, replacement }: Readonly<ResetTrafficP
|
|||||||
const type = data.data?.type;
|
const type = data.data?.type;
|
||||||
const checkout_url = data.data?.checkout_url;
|
const checkout_url = data.data?.checkout_url;
|
||||||
if (type === 'link') {
|
if (type === 'link') {
|
||||||
const width = 600;
|
window.location.href = checkout_url!;
|
||||||
const height = 800;
|
|
||||||
const left = (screen.width - width) / 2;
|
|
||||||
const top = (screen.height - height) / 2;
|
|
||||||
window.open(
|
|
||||||
checkout_url,
|
|
||||||
'newWindow',
|
|
||||||
`width=${width},height=${height},top=${top},left=${left},menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
getUserInfo();
|
getUserInfo();
|
||||||
router.push(`/payment?order_no=${orderNo}`);
|
router.push(`/payment?order_no=${orderNo}`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user