Use Result.ToActionResult in RefreshController

Import the API extensions and replace manual result handling in RefreshController with result.ToActionResult(), removing the inline empty-token check and switch-based error mapping. Also normalize the empty-token error message in UserSessionRefresher from "cannot be empty" to "can't be empty". This centralizes Result -> IActionResult conversion and simplifies the controller logic.
This commit is contained in:
Artemy
2026-07-25 20:26:34 +07:00
parent 3c785d5c89
commit 27fdcf85da
2 changed files with 3 additions and 19 deletions
@@ -34,7 +34,7 @@ public class UserSessionRefresher : IUserSessionRefresher
{
if (string.IsNullOrWhiteSpace(refreshToken))
{
return Result.Failure<RefreshResult>(Error.Failure("Auth.EmptyToken", "Refresh token cannot be empty."));
return Result.Failure<RefreshResult>(Error.Failure("Auth.EmptyToken", "Refresh token can't be empty."));
}
var hashedToken = _jwtTokenHasher.HashToken(refreshToken);