cambios session por Local

This commit is contained in:
2025-07-28 13:22:10 +02:00
parent 35c4d23a43
commit 18ee50c3c1
12 changed files with 37 additions and 30 deletions

View File

@@ -4,7 +4,8 @@
@inherits LayoutComponentBase
@inject NavigationManager Navigation
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
@inject ProtectedSessionStorage ProtectedSessionStore
@inject ProtectedLocalStorage ProtectedLocalStore
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
@@ -102,8 +103,8 @@
protected override async Task OnInitializedAsync()
{
var obtenerDatoAdmin = await ProtectedSessionStore.GetAsync<bool>("EsAdmin");
var obtenerDatoId = await ProtectedSessionStore.GetAsync<int>("idUsuario");
var obtenerDatoAdmin = await ProtectedLocalStore.GetAsync<bool>("EsAdmin");
var obtenerDatoId = await ProtectedLocalStore.GetAsync<int>("idUsuario");
// Redirigir al home si no hay token y la ruta no es pública
if (obtenerDatoId.Value == 0 || obtenerDatoAdmin.Value)
{