[frontend/session] Current should be a StoredUser

This commit is contained in:
Laura Hausmann 2024-04-09 16:45:46 +02:00 committed by Lilian
parent adb9267cd2
commit 1391451404
No known key found for this signature in database
GPG key ID: 007CA12D692829E1

View file

@ -10,7 +10,7 @@ internal class SessionService
[Inject] public ISyncLocalStorageService LocalStorage { get; } [Inject] public ISyncLocalStorageService LocalStorage { get; }
[Inject] public ApiService ApiService { get; } [Inject] public ApiService ApiService { get; }
public Dictionary<string, StoredUser> Users { get; } public Dictionary<string, StoredUser> Users { get; }
public UserResponse? Current { get; private set; } public StoredUser? Current { get; private set; }
public SessionService(ApiService apiService, ISyncLocalStorageService localStorage) public SessionService(ApiService apiService, ISyncLocalStorageService localStorage)
{ {
@ -39,6 +39,7 @@ internal class SessionService
{ {
Users[user.Id] = user; Users[user.Id] = user;
} }
WriteUsers(); WriteUsers();
} }
@ -60,6 +61,7 @@ internal class SessionService
Current = null; Current = null;
LocalStorage.RemoveItem("last_user"); LocalStorage.RemoveItem("last_user");
} }
public void SetSession(string id) public void SetSession(string id)
{ {
var user = GetUserById(id); var user = GetUserById(id);