From 8838fcd65c13b6f895787288c7dd5e633f352807 Mon Sep 17 00:00:00 2001 From: postb99 Date: Tue, 27 Jan 2026 22:25:43 +0100 Subject: [PATCH] Debug and fix called url --- Components/Pages/Account/Register.razor | 12 +++++++++--- Program.cs | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Components/Pages/Account/Register.razor b/Components/Pages/Account/Register.razor index abf511c..1bb617b 100644 --- a/Components/Pages/Account/Register.razor +++ b/Components/Pages/Account/Register.razor @@ -6,7 +6,7 @@ Register - +
@@ -52,11 +52,17 @@ private string messageCssClass = string.Empty; private string errorMessage = string.Empty; - async void HandleRegistration() + async Task HandleRegistration() { - var response = await _http.PostAsJsonAsync("api/auth/register", user); + var response = await _http.PostAsJsonAsync("/api/register", user); var result = await response.Content.ReadFromJsonAsync>(); message = result.Message; messageCssClass = result.Success ? "text-success" : "text-danger"; } + + async Task HandleInvalidSubmit() + { + message = "Data annotations validation failed."; + messageCssClass = "text-danger"; + } } \ No newline at end of file diff --git a/Program.cs b/Program.cs index e9ffab0..d922a94 100644 --- a/Program.cs +++ b/Program.cs @@ -24,7 +24,7 @@ app.UseHttpsRedirection(); app.UseAntiforgery(); -app.MapPost("/register", async (UserRegister request, IAuthService authService) => +app.MapPost("/api/register", async (UserRegister request, IAuthService authService) => await authService.Register(request.Email, request.Password)); app.MapStaticAssets();