Files
magman/MagMan.UI/Pages/ResetCache.razor.cs
2024-02-09 14:44:08 +01:00

50 lines
1.4 KiB
C#

using MagMan.Core.Services;
using MagMan.Data.Admin.Services;
using Microsoft.AspNetCore.Components;
using YamlDotNet.Core.Tokens;
namespace MagMan.UI.Pages
{
public partial class ResetCache
{
#region Protected Properties
[Inject]
protected MTAdminService MTService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
// salvo cliente selezionato...
int currCustId = AppMServ.CustomerID;
// resetto local/session storage utente
await AppMServ.StoreSessClear();
await AppMServ.StoreLocalClear();
// resetto cache redis
await MTService.FlushRedisCache();
string baseAppPath = Configuration["OptConf:BaseAddr"];
// reimposto cliente
AppMServ.CustomerID = currCustId;
await AppMServ.ClientIdSet(currCustId);
NavMan.NavigateTo(baseAppPath, true);
}
#endregion Protected Methods
#region Private Properties
[Inject]
private MessageService AppMServ { get; set; } = null!;
[Inject]
private IConfiguration Configuration { get; set; } = null!;
[Inject]
private NavigationManager NavMan { get; set; } = null!;
#endregion Private Properties
}
}