fix
This commit is contained in:
parent
e15399a85b
commit
d31998b8ef
2 changed files with 1 additions and 20 deletions
|
@ -4,23 +4,5 @@ namespace Femto.Api;
|
||||||
|
|
||||||
internal class CurrentUserContext : ICurrentUserContext
|
internal class CurrentUserContext : ICurrentUserContext
|
||||||
{
|
{
|
||||||
private CurrentUser? _currentUser;
|
public CurrentUser? CurrentUser { get; }
|
||||||
|
|
||||||
public CurrentUser? TryGetUserCurrentUser() => this._currentUser;
|
|
||||||
|
|
||||||
public bool HasUser => this._currentUser is not null;
|
|
||||||
|
|
||||||
public CurrentUser CurrentUser
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_currentUser is null)
|
|
||||||
throw new InvalidOperationException(
|
|
||||||
"don't access current user if not authenticated"
|
|
||||||
);
|
|
||||||
|
|
||||||
return _currentUser;
|
|
||||||
}
|
|
||||||
set => _currentUser = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ namespace Femto.Common;
|
||||||
|
|
||||||
public interface ICurrentUserContext
|
public interface ICurrentUserContext
|
||||||
{
|
{
|
||||||
bool HasUser { get; }
|
|
||||||
CurrentUser? CurrentUser { get; }
|
CurrentUser? CurrentUser { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue