We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2debe17 commit 7686acdCopy full SHA for 7686acd
TableBooking.Api/Controllers/UserController.cs
@@ -47,10 +47,16 @@ public async Task<IActionResult> Logout()
47
48
[HttpGet]
49
[Authorize]
50
- [Route("{id:guid}")]
51
- public async Task<AppUserDto> GetUserInfo(Guid id)
+ public async Task<AppUserDto> GetUserInfo()
52
{
53
- return await _userService.GetUserInfo(id, CancellationToken.None);
+ var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
+
54
+ if (userId == null)
55
+ {
56
+ throw new UnauthorizedAccessException("User is not authenticated.");
57
+ }
58
59
+ return await _userService.GetUserInfo(Guid.Parse(userId), CancellationToken.None);
60
}
61
62
0 commit comments