Something went wrong. Try again.
A personal wiki written in .NET
Something went wrong. Try again.
615 B · 22 lines
C#
at main
12345678910111213141516171819202122using System.Threading.Tasks;using Microsoft.AspNetCore.Authorization;using Microsoft.AspNetCore.Http;using Microsoft.AspNetCore.Http.HttpResults;using Microsoft.AspNetCore.Mvc;
namespace MiniWiki.Web.Users;
[Route("/users")]public class UsersController(UsersAction usersAction) : ControllerBase{ [HttpGet("/profile")] [Authorize] public async Task<IResult> GetProfileAsync() { var result = await usersAction.GetCurrentUserAsync(User);
if (result.IsError) return result.StatusResult!;
return new RazorComponentResult<Profile>(new { User = result.Object! }); }}