diff options
Diffstat (limited to 'ModerationClient/ViewModels/LoginViewModel.cs')
-rw-r--r-- | ModerationClient/ViewModels/LoginViewModel.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ModerationClient/ViewModels/LoginViewModel.cs b/ModerationClient/ViewModels/LoginViewModel.cs new file mode 100644 index 0000000..32f0d6e --- /dev/null +++ b/ModerationClient/ViewModels/LoginViewModel.cs @@ -0,0 +1,26 @@ +using System; +using System.Threading.Tasks; +using ModerationClient.Services; + +namespace ModerationClient.ViewModels; + +public partial class LoginViewModel(MatrixAuthenticationService authService) : ViewModelBase +{ + private Exception? _exception; + public string Username { get; set; } + public string Password { get; set; } + + public Exception? Exception { + get => _exception; + private set => SetProperty(ref _exception, value); + } + + public async Task LoginAsync() { + try { + Exception = null; + await authService.LoginAsync(Username, Password); + } catch (Exception e) { + Exception = e; + } + } +} \ No newline at end of file |