Debug and fix called url
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
<title>Register</title>
|
||||
|
||||
<EditForm Model="user" OnValidSubmit="HandleRegistration" FormName="registerForm">
|
||||
<EditForm Model="user" OnValidSubmit="HandleRegistration" OnInvalidSubmit="HandleInvalidSubmit" FormName="registerForm">
|
||||
<DataAnnotationsValidator/>
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<div class="col-md-4 p-5 shadow-sm border rounded-3">
|
||||
@@ -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<ServiceResponse<int>>();
|
||||
message = result.Message;
|
||||
messageCssClass = result.Success ? "text-success" : "text-danger";
|
||||
}
|
||||
|
||||
async Task HandleInvalidSubmit()
|
||||
{
|
||||
message = "Data annotations validation failed.";
|
||||
messageCssClass = "text-danger";
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user