From 712ad189c99570f686ab779782b2a873e172428e Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Tue, 13 Jun 2023 20:25:05 +0200 Subject: Change syntax style --- .../Shared/IndexComponents/IndexUserItem.razor | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'MatrixRoomUtils.Web/Shared/IndexComponents') diff --git a/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor b/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor index 03a7145..1fc70f2 100644 --- a/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor +++ b/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor @@ -1,10 +1,4 @@ -@using MatrixRoomUtils.Web.Classes -@using System.Text.Json -@using Blazored.LocalStorage -@using MatrixRoomUtils.Core @using MatrixRoomUtils.Core.Extensions -@using Index = MatrixRoomUtils.Web.Pages.Index -@using System.ComponentModel.DataAnnotations @inject ILocalStorageService LocalStorage @inject NavigationManager NavigationManager @@ -27,30 +21,33 @@ private string? _avatarUrl { get; set; } private int _roomCount { get; set; } = 0; - protected override async Task OnInitializedAsync() - { + protected override async Task OnInitializedAsync() { var hs = await new AuthenticatedHomeServer(User.LoginResponse.UserId, User.AccessToken, User.LoginResponse.HomeServer).Configure(); if (User.Profile.AvatarUrl != null && User.Profile.AvatarUrl != "") _avatarUrl = hs.ResolveMediaUri(User.Profile.AvatarUrl); else _avatarUrl = "https://api.dicebear.com/6.x/identicon/svg?seed=" + User.LoginResponse.UserId; - _roomCount = (await hs.GetJoinedRooms()).Count; + try { + _roomCount = (await hs.GetJoinedRooms()).Count; + } + catch { + _roomCount = -1; + } await base.OnInitializedAsync(); } - private async Task RemoveUser() - { + private async Task RemoveUser() { Console.WriteLine(User.ToJson()); RuntimeCache.LoginSessions.Remove(User.AccessToken); StateHasChanged(); } - private async Task SetCurrent() - { + private async Task SetCurrent() { RuntimeCache.LastUsedToken = User.AccessToken; //RuntimeCache.CurrentHomeserver = await MatrixAuth.ResolveHomeserverFromWellKnown(LocalStorageWrapper.LoginSessions[Token].LoginResponse.HomeServer); await LocalStorageWrapper.SaveToLocalStorage(LocalStorage); await LocalStorageWrapper.InitialiseRuntimeVariables(LocalStorage); StateHasChanged(); } + } \ No newline at end of file -- cgit 1.4.1