diff --git a/HerramientaCASA/Components/Layout/ConfiguracionLayout.razor b/HerramientaCASA/Components/Layout/ConfiguracionLayout.razor index 83f0e03..af1319d 100644 --- a/HerramientaCASA/Components/Layout/ConfiguracionLayout.razor +++ b/HerramientaCASA/Components/Layout/ConfiguracionLayout.razor @@ -7,6 +7,7 @@ @using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage @inject ProtectedLocalStorage ProtectedLocalStore @inject UserState userState +@inject IJSRuntime JS
@@ -107,31 +108,55 @@ @code { - protected override async Task OnInitializedAsync() - { - // Redirigir al home si no hay token y la ruta no es pública - if (userState.idUser == 0) -) - { - Navigation.NavigateTo("/", true); - } - } - - - // protected override void OnAfterRender(bool firstRender) + // protected override async Task OnInitializedAsync() // { - // if (firstRender) + // // Redirigir al home si no hay token y la ruta no es pública + // if (userState.idUser == 0) // { - // string? urlAnterior = HttpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString(); - // string rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri); - - // if (rutaActual != "Denegado") - // { - // if (string.IsNullOrEmpty(urlAnterior) || urlAnterior.Contains("cacoa.es")) - // { - // Navigation.NavigateTo("/Denegado", true); - // } - // } + // Navigation.NavigateTo("/", true); // } // } + + + string? urlAnterior = ""; + + bool urlVaida = true; + string rutaActual = ""; + + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + urlAnterior = await JS.InvokeAsync@@ -285,7 +286,10 @@