Files
mapo-core/MP-TAB3/Pages/Logout.razor.cs
T
2024-01-04 19:35:52 +01:00

64 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP_TAB3;
using MP_TAB3.Shared;
using MP_TAB3.Components;
using MP.Data;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.Data.Services;
using Newtonsoft.Json;
using NLog;
using EgwCoreLib.Razor;
using Blazored.LocalStorage;
namespace MP_TAB3.Pages
{
public partial class Logout
{
[Inject]
protected ILocalStorageService localStorage { get; set; } = null!;
[Inject]
protected TabDataService TDService { get; set; } = null!;
[Inject]
protected MessageService MsgServ { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
await MsgServ.SetCurrOperDtoLSAsync("");
await MsgServ.IdxMaccSet("");
await MsgServ.LastOpenedPageSet("");
var CurrOprTknLS = await MsgServ.GetCurrOperDtoLSAsync();
var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
if (!string.IsNullOrEmpty(CurrOprTknLS))
{
var decryptedData = MsgServ.DecryptData(CurrOprTknLS);
if (!string.IsNullOrEmpty(decryptedData))
{
var oprObj = JsonConvert.DeserializeObject<userTknDTO>(decryptedData);
if (oprObj != null)
{
MsgServ.RigaOper = oprObj.currOpr;
}
}
}
await TDService.OperatoreDeleteRedis(MsgServ.MatrOpr, CurrDevGuid);
MsgServ.RigaOper = null;
NavMan.NavigateTo("reg-new-device", true);
}
}
}