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();