about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/LoginPage.razor
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/LoginPage.razor')
-rw-r--r--MatrixRoomUtils.Web/Pages/LoginPage.razor21
1 files changed, 10 insertions, 11 deletions
diff --git a/MatrixRoomUtils.Web/Pages/LoginPage.razor b/MatrixRoomUtils.Web/Pages/LoginPage.razor
index aead5e8..da9345a 100644
--- a/MatrixRoomUtils.Web/Pages/LoginPage.razor
+++ b/MatrixRoomUtils.Web/Pages/LoginPage.razor
@@ -1,7 +1,5 @@
 @page "/Login"
 @using MatrixRoomUtils.Authentication
-@using MatrixRoomUtils.Web.Classes
-@using Blazored.LocalStorage
 @inject ILocalStorageService LocalStorage
 <h3>Login</h3>
 
@@ -23,24 +21,25 @@
     string homeserver = "";
     string username = "";
     string password = "";
+
     async Task Login()
     {
         var result = await MatrixAuth.Login(homeserver, username, password);
         Console.WriteLine($"Obtained access token for {result.UserId}!");
-        
-        LocalStorageWrapper.AccessToken = result.AccessToken;
+
+        RuntimeCache.AccessToken = result.AccessToken;
 
         var userinfo = new UserInfo()
         {
-            LoginResponse = result
+            LoginResponse = result,
+            AccessToken = result.AccessToken,
+            Profile = await MatrixAuth.GetProfile(result.HomeServer, result.UserId)
         };
-        userinfo.Profile = await MatrixAuth.GetProfile(result.HomeServer, result.UserId);
-
-        LocalStorageWrapper.LoginSessions.Add(result.AccessToken, userinfo);
-        LocalStorageWrapper.CurrentHomeserver = await MatrixAuth.ResolveHomeserverFromWellKnown(result.HomeServer);
-        
+    //TODO: refactor
+        RuntimeCache.LoginSessions.Add(userinfo.AccessToken, userinfo);
+        RuntimeCache.CurrentHomeserver = await MatrixAuth.ResolveHomeserverFromWellKnown(result.HomeServer);
 
         await LocalStorageWrapper.SaveToLocalStorage(LocalStorage);
-
     }
+
 }
\ No newline at end of file