Redirect checkout to billing with status

This commit is contained in:
Codex Agent
2026-01-12 11:49:10 +01:00
parent 47f6343347
commit a251740aff
4 changed files with 45 additions and 3 deletions

View File

@@ -108,6 +108,34 @@ export default function MobileBillingPage() {
}
}, [location.hash, loading]);
React.useEffect(() => {
if (!location.search) {
return;
}
const params = new URLSearchParams(location.search);
const checkout = params.get('checkout');
if (!checkout) {
return;
}
if (checkout === 'success') {
toast.success(t('billing.checkoutSuccess', 'Checkout completed. Your package will activate shortly.'));
} else if (checkout === 'cancel') {
toast(t('billing.checkoutCancelled', 'Checkout was cancelled.'));
}
params.delete('checkout');
navigate(
{
pathname: location.pathname,
search: params.toString(),
hash: location.hash,
},
{ replace: true },
);
}, [location.hash, location.pathname, location.search, navigate, t]);
return (
<MobileShell
activeTab="profile"
@@ -535,4 +563,4 @@ function formatDate(value: string | null | undefined): string {
const date = new Date(value);
if (Number.isNaN(date.getTime())) return '—';
return date.toLocaleDateString(undefined, { day: '2-digit', month: 'short', year: 'numeric' });
}
}