@using MatrixRoomUtils.Authentication @using MatrixRoomUtils.Web.Classes @using System.Text.Json @using Blazored.LocalStorage @using MatrixRoomUtils.Extensions @using Index = MatrixRoomUtils.Web.Pages.Index @inject ILocalStorageService LocalStorage @inject NavigationManager NavigationManager
@User.Profile.DisplayName on @User.LoginResponse.HomeServer Remove
@code { [Parameter] public string Token { get; set; } [Parameter] public UserInfo User { get; set; } private string _avatarUrl { get; set; } private bool _removed { get; set; } = false; protected override async Task OnInitializedAsync() { if(User.Profile.AvatarUrl != null && User.Profile.AvatarUrl != "") _avatarUrl = await User.Profile.AvatarUrl.GetMediaUrl(); else _avatarUrl = "https://api.dicebear.com/6.x/identicon/svg?seed=" + User.LoginResponse.UserId; await base.OnInitializedAsync(); } private async Task RemoveUser() { RuntimeStorage.UsersCache.Remove(Token); await RuntimeStorage.SaveToLocalStorage(LocalStorage); _removed = true; StateHasChanged(); } private async Task SetCurrent() { RuntimeStorage.AccessToken = Token; RuntimeStorage.CurrentHomeserver = await MatrixAccount.ResolveHomeserverFromWellKnown(RuntimeStorage.UsersCache[Token].LoginResponse.HomeServer); await RuntimeStorage.SaveToLocalStorage(LocalStorage); StateHasChanged(); } }