diff --git a/MP.INVE/Pages/OperatoreLogin.razor b/MP.INVE/Pages/OperatoreLogin.razor
index 73e37eab..aef72743 100644
--- a/MP.INVE/Pages/OperatoreLogin.razor
+++ b/MP.INVE/Pages/OperatoreLogin.razor
@@ -4,20 +4,21 @@
-
-
-
diff --git a/MP.INVE/Pages/OperatoreLogin.razor.cs b/MP.INVE/Pages/OperatoreLogin.razor.cs
index e6b2a3a5..73a3f8de 100644
--- a/MP.INVE/Pages/OperatoreLogin.razor.cs
+++ b/MP.INVE/Pages/OperatoreLogin.razor.cs
@@ -16,6 +16,7 @@ using MP.INVE.Data;
using MP.INVE.Shared;
using MP.INVE.Components;
using MP.Data.DatabaseModels;
+using Blazored.SessionStorage;
namespace MP.INVE.Pages
{
@@ -25,9 +26,11 @@ namespace MP.INVE.Pages
private MiDataService MIDataservice { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
+ [Inject]
+ private ISessionStorageService sessionStorage { get; set; } = null!;
- private int idOperatore { get; set; }
- private string authKey { get; set; }
+ private int idOperatore { get; set; } = 0;
+ private string authKey { get; set; } = "";
private List
? elencoOperatori;
@@ -35,16 +38,18 @@ namespace MP.INVE.Pages
{
//await FilterChanged.InvokeAsync(actFilter);
await Task.Delay(1);
- elencoOperatori = MIDataservice.ElencoOperatori();
+ elencoOperatori = MIDataservice.ElencoOperatori(idOperatore, authKey);
}
private void login()
{
- var ok = MIDataservice.LoginOperatore(idOperatore, authKey);
+ elencoOperatori = MIDataservice.ElencoOperatori(idOperatore, authKey);
- if (ok)
+ if (elencoOperatori.Count == 1)
{
NavManager.NavigateTo("/Starter", true);
+ sessionStorage.SetItemAsync("MatrOpr", idOperatore);
+ sessionStorage.SetItemAsync("AuthKey", authKey);
}
else
{
diff --git a/MP.INVE/Pages/Starter.razor b/MP.INVE/Pages/Starter.razor
index 47b44abf..1f41fc74 100644
--- a/MP.INVE/Pages/Starter.razor
+++ b/MP.INVE/Pages/Starter.razor
@@ -9,34 +9,4 @@
@*
*@
-@code {
- [Inject]
- private IConfiguration Configuration { get; set; } = null!;
- protected override async Task OnAfterRenderAsync(bool firstRender)
- {
- if (firstRender)
- {
- await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}");
- await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode);
- }
- }
-
- protected string BaseUrlTab
- {
- get => $"{Configuration["ServerConf:BaseUrl"]}";
- }
-
-
- protected string rawCode
- {
- get
- {
- string answ = "";
- answ = $"{BaseUrlTab}MatrOpr={101}&UserAuthKey={12345}";
- return answ;
- }
- }
-
-
-}
diff --git a/MP.INVE/Pages/Starter.razor.cs b/MP.INVE/Pages/Starter.razor.cs
new file mode 100644
index 00000000..aa197872
--- /dev/null
+++ b/MP.INVE/Pages/Starter.razor.cs
@@ -0,0 +1,68 @@
+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.INVE;
+using MP.INVE.Shared;
+using MP.INVE.Components;
+using Blazored.SessionStorage;
+
+namespace MP.INVE.Pages
+{
+ public partial class Starter
+ {
+ [Inject]
+ private IConfiguration Configuration { get; set; } = null !;
+
+ [Inject]
+ private ISessionStorageService sessionStorage { get; set; } = null!;
+
+ private int idOperatore { get; set; } = 0;
+ private string authKey { get; set; } = "";
+
+ protected override async Task OnInitializedAsync()
+ {
+ await getId();
+ await getAuth();
+ }
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ if (firstRender)
+ {
+ await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}");
+ await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode);
+ }
+ }
+
+ protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrl"]}"; }
+
+ protected async Task getId()
+ {
+ idOperatore = await sessionStorage.GetItemAsync("MatrOpr");
+ }
+ protected async Task getAuth()
+ {
+ authKey = await sessionStorage.GetItemAsync("AuthKey");
+ }
+
+ protected string rawCode
+ {
+ get
+ {
+ string answ = "";
+ answ = $"{BaseUrlTab}MatrOpr={idOperatore}&UserAuthKey={authKey}";
+ return answ;
+ }
+ }
+ }
+}
\ No newline at end of file