[frontend/session] Current should be a StoredUser
This commit is contained in:
parent
adb9267cd2
commit
1391451404
1 changed files with 57 additions and 55 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue