@page "/login" @using BlazorWebAssembly.Services @using LibraryManagement.Shared.Models @inject AuthService AuthService @inject NavigationManager Navigation

Welcome Back

Enter your credentials to access your library account.

@if (!string.IsNullOrEmpty(_errorMessage)) {
@_errorMessage
}

Don't have an account? Create Account

@code { private LoginRequest _loginModel = new(); private bool _isLoading = false; private string? _errorMessage; private async Task HandleLogin() { _isLoading = true; _errorMessage = null; try { var success = await AuthService.LoginAsync(_loginModel); if (success) { Navigation.NavigateTo("/"); } else { _errorMessage = "Invalid email or password. Please try again."; } } catch (Exception ex) { _errorMessage = "A connection error occurred. Please check your network."; } finally { _isLoading = false; } } }