fix loading public posts
This commit is contained in:
parent
3f1c6280ba
commit
dc999fd7cc
3 changed files with 3 additions and 5 deletions
|
@ -76,6 +76,6 @@ public class PostsController(IBlogModule blogModule, ICurrentUserContext current
|
|||
[Authorize]
|
||||
public async Task DeletePost(Guid postId, CancellationToken cancellationToken)
|
||||
{
|
||||
await blogModule.Command(new DeletePostCommand(postId, currentUserContext.CurrentUser.Id), cancellationToken);
|
||||
await blogModule.Command(new DeletePostCommand(postId, currentUserContext.CurrentUser!.Id), cancellationToken);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ internal class CurrentUserContext : ICurrentUserContext
|
|||
{
|
||||
private CurrentUser? _currentUser;
|
||||
|
||||
public CurrentUser? tryGetUserCurrentUser() => this._currentUser;
|
||||
public CurrentUser? TryGetUserCurrentUser() => this._currentUser;
|
||||
|
||||
public bool HasUser => this._currentUser is not null;
|
||||
|
||||
|
|
|
@ -2,10 +2,8 @@ namespace Femto.Common;
|
|||
|
||||
public interface ICurrentUserContext
|
||||
{
|
||||
CurrentUser? tryGetUserCurrentUser();
|
||||
|
||||
bool HasUser { get; }
|
||||
CurrentUser CurrentUser { get; }
|
||||
CurrentUser? CurrentUser { get; }
|
||||
}
|
||||
|
||||
public record CurrentUser(Guid Id, string Username, string SessionId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue