about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomStateEditorPage.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-03 20:42:20 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-03 20:42:20 +0200
commitb02fb81a56bd94b38fdb26771c3e591419f0f49c (patch)
tree617538d36ff9be9ba0f5d13cb6076b02f017a91b /MatrixRoomUtils.Web/Pages/RoomStateEditorPage.razor
parentRefactor (diff)
downloadMatrixUtils-b02fb81a56bd94b38fdb26771c3e591419f0f49c.tar.xz
Small refactoring
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/RoomStateEditorPage.razor')
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomStateEditorPage.razor16
1 files changed, 4 insertions, 12 deletions
diff --git a/MatrixRoomUtils.Web/Pages/RoomStateEditorPage.razor b/MatrixRoomUtils.Web/Pages/RoomStateEditorPage.razor
index 6ad99d9..e15ce20 100644
--- a/MatrixRoomUtils.Web/Pages/RoomStateEditorPage.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomStateEditorPage.razor
@@ -1,14 +1,6 @@
 @page "/RoomStateViewer/{RoomId}/Edit"
-@using MatrixRoomUtils.Authentication
-@using MatrixRoomUtils.Web.Classes
-@using Blazored.LocalStorage
 @using System.Net.Http.Headers
 @using System.Text.Json
-@using System.Xml.Schema
-@using MatrixRoomUtils.Extensions
-@using MatrixRoomUtils.StateEventTypes
-@using MatrixRoomUtils.Web.Shared.IndexComponents
-@using Microsoft.Win32.SafeHandles
 @inject ILocalStorageService LocalStorage
 @inject NavigationManager NavigationManager
 <h3>Room state editor</h3>
@@ -55,9 +47,9 @@
 
     protected override async Task OnInitializedAsync()
     {
-        if (!LocalStorageWrapper.WasLoaded) await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
+        if (!RuntimeCache.WasLoaded) await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
         await base.OnInitializedAsync();
-        if (LocalStorageWrapper.AccessToken == null || LocalStorageWrapper.CurrentHomeserver == null)
+        if (RuntimeCache.CurrentHomeServer != null)
         {
             NavigationManager.NavigateTo("/Login");
             return;
@@ -73,8 +65,8 @@
     {
         int StateLoaded = 0;
         using var client = new HttpClient();
-        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalStorageWrapper.AccessToken);
-        var response = await client.GetAsync($"{LocalStorageWrapper.CurrentHomeserver}/_matrix/client/r0/rooms/{RoomId}/state");
+        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", RuntimeCache.AccessToken);
+        var response = await client.GetAsync($"{RuntimeCache.CurrentHomeserver}/_matrix/client/r0/rooms/{RoomId}/state");
     // var response = await client.GetAsync($"http://localhost:5117/matrix-hq-state.json");
     //var _events = await response.Content.ReadFromJsonAsync<Queue<StateEventStruct>>();
         var _data = await response.Content.ReadAsStreamAsync();