This commit is contained in:
john 2025-05-21 13:55:04 +02:00
parent e15399a85b
commit d31998b8ef
2 changed files with 1 additions and 20 deletions

View file

@ -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;
}
} }

View file

@ -2,7 +2,6 @@ namespace Femto.Common;
public interface ICurrentUserContext public interface ICurrentUserContext
{ {
bool HasUser { get; }
CurrentUser? CurrentUser { get; } CurrentUser? CurrentUser { get; }
} }