[accelerator] fix redirects

This commit is contained in:
nymkappa 2024-04-16 17:02:10 +09:00
parent 96d85dcacd
commit ada18a0413
No known key found for this signature in database
GPG Key ID: 92358FC85D9645DE

View File

@ -234,6 +234,10 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
} }
setTimeout(() => { setTimeout(() => {
that.closeModal(); that.closeModal();
if (window.history.replaceState) {
const urlParams = new URLSearchParams(window.location.search);
window.history.replaceState(null, null, window.location.toString().replace(`?cash_request_id=${urlParams.get('cash_request_id')}`, ''));
}
}, 1000); }, 1000);
}, },
error: (response) => { error: (response) => {
@ -242,6 +246,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
} else { } else {
that.error = response.error; that.error = response.error;
setTimeout(() => { setTimeout(() => {
// Reset everything by reloading the page :D, can be improved
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
window.location.assign(window.location.toString().replace(`?cash_request_id=${urlParams.get('cash_request_id')}`, ``)); window.location.assign(window.location.toString().replace(`?cash_request_id=${urlParams.get('cash_request_id')}`, ``));
}, 3000); }, 3000);