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
2 changed files with 8 additions and 4 deletions

View File

@@ -644,12 +644,14 @@ namespace BTCPayServer.Controllers
[HttpGet] [HttpGet]
[Route("i/{invoiceId}/status")] [Route("i/{invoiceId}/status")]
[Route("i/{invoiceId}/{paymentMethodId}/status")] [Route("i/{invoiceId}/{implicitPaymentMethodId}/status")]
[Route("invoice/{invoiceId}/status")] [Route("invoice/{invoiceId}/status")]
[Route("invoice/{invoiceId}/{paymentMethodId}/status")] [Route("invoice/{invoiceId}/{implicitPaymentMethodId}/status")]
[Route("invoice/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); var model = await GetInvoiceModel(invoiceId, paymentMethodId == null ? null : PaymentMethodId.Parse(paymentMethodId), lang);
if (model == null) if (model == null)
return NotFound(); return NotFound();

View File

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