From b933f7ed1189c7e14d82b4fcf5c98fb3ef4b9cf1 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Thu, 4 May 2023 00:13:25 +0200 Subject: Refactoring --- MatrixRoomUtils.Web/Pages/Index.razor | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'MatrixRoomUtils.Web/Pages/Index.razor') diff --git a/MatrixRoomUtils.Web/Pages/Index.razor b/MatrixRoomUtils.Web/Pages/Index.razor index 8a5dcc4..67cefed 100644 --- a/MatrixRoomUtils.Web/Pages/Index.razor +++ b/MatrixRoomUtils.Web/Pages/Index.razor @@ -1,6 +1,7 @@ - @page "/" - @using MatrixRoomUtils.Web.Shared.IndexComponents - @inject NavigationManager NavigationManager +@page "/" +@using MatrixRoomUtils.Web.Shared.IndexComponents +@using MatrixRoomUtils.Core +@inject NavigationManager NavigationManager @inject ILocalStorageService LocalStorage Index @@ -11,20 +12,23 @@ Small collection of tools to do not-so-everyday things.

Signed in accounts - Add new account or Import from TSV

-@{ - if (!RuntimeCache.WasLoaded) - { - Console.WriteLine("[INDEX] !!! LOCALSTORAGE WAS NOT LOADED !!!"); - LocalStorageWrapper.LoadFromLocalStorage(LocalStorage).GetAwaiter().OnCompleted(() => - { - Console.WriteLine("Users in cache: " + RuntimeCache .LoginSessions.Count); - StateHasChanged(); - }); - } -}
@foreach (var (token, user) in RuntimeCache.LoginSessions) { } - \ No newline at end of file + + +@code +{ + protected override async Task OnInitializedAsync() + { + if (!RuntimeCache.WasLoaded) + { + Console.WriteLine("[INDEX] !!! LOCALSTORAGE WAS NOT LOADED !!!"); + await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); + } + await base.OnInitializedAsync(); + await LocalStorageWrapper.ReloadLocalStorage(LocalStorage); + } +} \ No newline at end of file -- cgit 1.5.1