fix passaggio sessionId in jumper

This commit is contained in:
zaccaria.majid
2022-11-23 10:30:32 +01:00
parent 357e74b928
commit eae97d42f0
+9 -3
View File
@@ -20,13 +20,16 @@ using MP.INVE.Data;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using Microsoft.IdentityModel.Tokens;
using Blazored.SessionStorage;
namespace MP.INVE.Pages
{
public partial class Jumper
{
[Inject]
protected ILocalStorageService localStorage { get; set; } = null!;
protected ILocalStorageService localStorage { get; set; } = null!;
[Inject]
protected ISessionStorageService sessionStorage { get; set; } = null!;
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
[Inject]
@@ -37,14 +40,16 @@ namespace MP.INVE.Pages
private List<AnagOperatoriModel> operatore = new List<AnagOperatoriModel>();
protected string idOPeratore { get; set; } = null!;
protected string authKey { get; set; } = null!;
protected int inveSessionId { get; set; } = 0;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey))
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId))
{
idOPeratore = _matrOpr;
authKey = _authKey;
inveSessionId = int.Parse(_inveSessionId);
}
string pw = MIService.DeriptData(authKey);
logged = MIService.loginOperatore(int.Parse(idOPeratore), pw);
@@ -69,8 +74,9 @@ namespace MP.INVE.Pages
};
await localStorage.SetItemAsync("MatrOpr", currOpr);
NavManager.NavigateTo("Acquisizione");
await sessionStorage.SetItemAsync("idSessione", inveSessionId);
}
NavManager.NavigateTo($"Acquisizione?idSessione={inveSessionId}");
}
}
}