Fix: The checkout page would reload the page when changing payment method

This commit is contained in:
nicolas.dorier 2021-10-30 13:57:24 +09:00
parent d6e3fb46ee
commit 933dc6be31
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 8 additions and 4 deletions

View file

@ -644,12 +644,14 @@ namespace BTCPayServer.Controllers
[HttpGet]
[Route("i/{invoiceId}/status")]
[Route("i/{invoiceId}/{paymentMethodId}/status")]
[Route("i/{invoiceId}/{implicitPaymentMethodId}/status")]
[Route("invoice/{invoiceId}/status")]
[Route("invoice/{invoiceId}/{paymentMethodId}/status")]
[Route("invoice/{invoiceId}/{implicitPaymentMethodId}/status")]
[Route("invoice/status")]
public async Task<IActionResult> GetStatus(string invoiceId, string? paymentMethodId = null, [FromQuery] string? lang = null)
public async Task<IActionResult> GetStatus(string invoiceId, string? paymentMethodId = null, string? implicitPaymentMethodId = null, [FromQuery] string? lang = null)
{
if (string.IsNullOrEmpty(paymentMethodId))
paymentMethodId = implicitPaymentMethodId;
var model = await GetInvoiceModel(invoiceId, paymentMethodId == null ? null : PaymentMethodId.Parse(paymentMethodId), lang);
if (model == null)
return NotFound();

View file

@ -2,7 +2,9 @@ function delegate(eventType, selector, handler, root) {
(root || document).addEventListener(eventType, function(event) {
const target = event.target.closest(selector);
if (target) {
handler.call(this, event);
if (handler.call(this, event) === false) {
event.preventDefault();
}
}
});
}