mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Make invoice list search term persistent for session
This commit is contained in:
@@ -19,6 +19,7 @@ using BTCPayServer.Security;
|
||||
using BTCPayServer.Services.Invoices;
|
||||
using BTCPayServer.Services.Invoices.Export;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
@@ -466,6 +467,10 @@ namespace BTCPayServer.Controllers
|
||||
[BitpayAPIConstraint(false)]
|
||||
public async Task<IActionResult> ListInvoices(string searchTerm = null, int skip = 0, int count = 50)
|
||||
{
|
||||
if (searchTerm == null)
|
||||
{
|
||||
searchTerm = HttpContext.Session.GetString("InvoicesSearchTerm");
|
||||
}
|
||||
var model = new InvoicesModel
|
||||
{
|
||||
SearchTerm = searchTerm,
|
||||
@@ -627,6 +632,14 @@ namespace BTCPayServer.Controllers
|
||||
[BitpayAPIConstraint(false)]
|
||||
public IActionResult SearchInvoice(InvoicesModel invoices)
|
||||
{
|
||||
if (invoices.SearchTerm == null)
|
||||
{
|
||||
HttpContext.Session.Remove("InvoicesSearchTerm");
|
||||
}
|
||||
else
|
||||
{
|
||||
HttpContext.Session.SetString("InvoicesSearchTerm", invoices.SearchTerm);
|
||||
}
|
||||
return RedirectToAction(nameof(ListInvoices), new
|
||||
{
|
||||
searchTerm = invoices.SearchTerm,
|
||||
|
||||
Reference in New Issue
Block a user