Still invalid submit. Tried to add an API route to call service through http.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
@page "/register"
|
||||
@using Sandbox.Models.ViewModels
|
||||
@using Sandbox.Services.AuthService
|
||||
|
||||
@* @inject AuthenticationStateProvider AuthenticationStateProvider *@
|
||||
@* @inject NavigationManager NavigationManager *@
|
||||
@inject IAuthService AuthService
|
||||
|
||||
<title>Register</title>
|
||||
|
||||
@@ -48,6 +46,7 @@
|
||||
|
||||
@code {
|
||||
UserRegister user = new();
|
||||
HttpClient _http = new();
|
||||
|
||||
private string message = string.Empty;
|
||||
private string messageCssClass = string.Empty;
|
||||
@@ -55,7 +54,8 @@
|
||||
|
||||
async void HandleRegistration()
|
||||
{
|
||||
var result = await AuthService.Register(user.Email, user.Password);
|
||||
var response = await _http.PostAsJsonAsync("api/auth/register", user);
|
||||
var result = await response.Content.ReadFromJsonAsync<ServiceResponse<int>>();
|
||||
message = result.Message;
|
||||
messageCssClass = result.Success ? "text-success" : "text-danger";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user