Fixed new user username formating

This commit is contained in:
2026-10-21 10:16:54 +02:00
parent 5d7e2f74ce
commit 95a86e1a87
6 changed files with 63 additions and 14 deletions
@@ -1,4 +1,4 @@
using PostFundManagement.Domain.Abstractions;
using PostFundManagement.Domain.Abstractions;
using PostFundManagement.Domain.Errors;
using PostFundManagement.Domain.Models.Security;
@@ -13,7 +13,11 @@ public class SkorubaUserService(IHttpClientFactory httpClientFactory) : ISkoruba
var response = await httpClient.PostAsJsonAsync("api/users", request, cancellationToken);
if (!response.IsSuccessStatusCode)
return Result.Fail(CreateError.Create(response.ReasonPhrase!));
{
var errorBody = await response.Content.ReadAsStringAsync(cancellationToken);
var errorMsg = !string.IsNullOrWhiteSpace(errorBody) ? errorBody : response.ReasonPhrase!;
return Result.Fail(CreateError.Create(errorMsg));
}
var created = await response.Content.ReadFromJsonAsync<UserResponse>(cancellationToken: cancellationToken);