This commit is contained in:
Oliver Booth 2024-02-25 14:19:07 +00:00
parent 3917dda658
commit 6db3aba1c2
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
2 changed files with 11 additions and 2 deletions

View File

@ -68,7 +68,9 @@ public sealed class AdminController : ControllerBase
public IActionResult Logout()
{
if (_sessionService.TryGetSession(Request, out ISession? session))
{
_sessionService.DeleteSession(session);
}
return _sessionService.DeleteSessionCookie(Response);
}

View File

@ -56,7 +56,10 @@ public sealed class BlogApiController : ControllerBase
[HttpGet("author/{id:guid}")]
public IActionResult GetAuthor(Guid id)
{
if (!_userService.TryGetUser(id, out IUser? author)) return NotFound();
if (!_userService.TryGetUser(id, out IUser? author))
{
return NotFound();
}
return Ok(new
{
@ -69,7 +72,11 @@ public sealed class BlogApiController : ControllerBase
[HttpGet("post/{id:guid?}")]
public IActionResult GetPost(Guid id)
{
if (!_blogPostService.TryGetPost(id, out IBlogPost? post)) return NotFound();
if (!_blogPostService.TryGetPost(id, out IBlogPost? post))
{
return NotFound();
}
return Ok(CreatePostObject(post, true));
}