refactor(AuthController): remove try-catch block
This commit is contained in:
parent
5f7e040e3e
commit
4725614bb3
@ -39,8 +39,6 @@ public class AuthController : ControllerBase
|
|||||||
[HttpGet("user")]
|
[HttpGet("user")]
|
||||||
[Obsolete("Use MediatR")]
|
[Obsolete("Use MediatR")]
|
||||||
public async Task<IActionResult> GetUserWithClaims()
|
public async Task<IActionResult> GetUserWithClaims()
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// Extract the username from the Name claim.
|
// Extract the username from the Name claim.
|
||||||
string? username = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value;
|
string? username = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value;
|
||||||
@ -55,12 +53,6 @@ public class AuthController : ControllerBase
|
|||||||
return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound]));
|
return NotFound(Result.Fail().Message(_localizer[Key.UserNotFound]));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "{Message}", ex.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpPost("logout")]
|
[HttpPost("logout")]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user