You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
795 B
33 lines
795 B
using HeartTrack.Models;
|
|
using HeartTrack.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace HeartTrack.Pages
|
|
{
|
|
public partial class Login
|
|
{
|
|
[Inject]
|
|
public CustomStateProvider AuthStateProvider { get; set; }
|
|
|
|
[Inject]
|
|
public NavigationManager NavigationManager { get; set; }
|
|
|
|
private string error { get; set; }
|
|
private LoginRequest loginRequest { get; set; } = new LoginRequest();
|
|
|
|
private async Task OnSubmit()
|
|
{
|
|
error = null;
|
|
try
|
|
{
|
|
await AuthStateProvider.Login(loginRequest);
|
|
NavigationManager.NavigateTo("");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
error = ex.Message;
|
|
}
|
|
}
|
|
}
|
|
}
|