about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/Index.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-04 00:13:25 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-04 00:18:46 +0200
commitb933f7ed1189c7e14d82b4fcf5c98fb3ef4b9cf1 (patch)
tree4176eb2b7f1befca685d00e119d842eb3f07da1f /MatrixRoomUtils.Web/Pages/Index.razor
parentSmall refactoring (diff)
downloadMatrixUtils-b933f7ed1189c7e14d82b4fcf5c98fb3ef4b9cf1.tar.xz
Refactoring
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/Index.razor')
-rw-r--r--MatrixRoomUtils.Web/Pages/Index.razor34
1 files changed, 19 insertions, 15 deletions
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 <PageTitle>Index</PageTitle> @@ -11,20 +12,23 @@ Small collection of tools to do not-so-everyday things. <br/><br/> <h5>Signed in accounts - <a href="/Login">Add new account</a> or <a href="/ImportUsers">Import from TSV</a></h5> <hr/> -@{ - if (!RuntimeCache.WasLoaded) - { - Console.WriteLine("[INDEX] !!! LOCALSTORAGE WAS NOT LOADED !!!"); - LocalStorageWrapper.LoadFromLocalStorage(LocalStorage).GetAwaiter().OnCompleted(() => - { - Console.WriteLine("Users in cache: " + RuntimeCache .LoginSessions.Count); - StateHasChanged(); - }); - } -} <form> @foreach (var (token, user) in RuntimeCache.LoginSessions) { <IndexUserItem User="@user"/> } -</form> \ No newline at end of file +</form> + +@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