mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-03 17:36:59 +01:00
Make invoice list search term persistent for session
This commit is contained in:
parent
7ef11817c1
commit
96d28f00cc
2 changed files with 15 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace BTCPayServer.Hosting
|
|||
.AddDefaultTokenProviders();
|
||||
services.AddSignalR();
|
||||
services.AddBTCPayServer();
|
||||
services.AddSession();
|
||||
services.AddMvc(o =>
|
||||
{
|
||||
o.Filters.Add(new XFrameOptionsAttribute("DENY"));
|
||||
|
@ -169,6 +170,7 @@ namespace BTCPayServer.Hosting
|
|||
app.UsePayServer();
|
||||
app.UseStaticFiles();
|
||||
app.UseAuthentication();
|
||||
app.UseSession();
|
||||
app.UseSignalR(route =>
|
||||
{
|
||||
AppHub.Register(route);
|
||||
|
|
Loading…
Add table
Reference in a new issue