From 0e4ad179489c0c269c1f82832a7ffe6fae187794 Mon Sep 17 00:00:00 2001 From: seth poop Date: Wed, 23 Oct 2024 21:32:43 -0600 Subject: [PATCH] Added mudpopover provider --- BookStoreApp.API/BookStoreApp.API.csproj | 2 +- .../Pages/Users/Login.razor | 43 +++++++++---------- .../Pages/Users/Login.razor.cs | 2 + .../Pages/Users/Register.razor | 2 +- .../Pages/Users/Register.razor.cs | 5 ++- .../Shared/MainLayout.razor | 1 + 6 files changed, 30 insertions(+), 25 deletions(-) diff --git a/BookStoreApp.API/BookStoreApp.API.csproj b/BookStoreApp.API/BookStoreApp.API.csproj index 768d484..0ae5a93 100644 --- a/BookStoreApp.API/BookStoreApp.API.csproj +++ b/BookStoreApp.API/BookStoreApp.API.csproj @@ -22,7 +22,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor b/BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor index 6aeae17..d3cff27 100644 --- a/BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor +++ b/BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor @@ -6,29 +6,28 @@

Login

- - - + + + -
- - - -
+
+ + + +
-
- - - -
+
+ + + +
-
-
- -
-
- Sign Up -
+
+
+
- - +
+ Sign Up +
+
+ diff --git a/BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor.cs b/BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor.cs index c0b4f8c..2676b07 100644 --- a/BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor.cs +++ b/BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor.cs @@ -24,7 +24,9 @@ private async Task HandleLogin() navManager.NavigateTo("/"); } + _loading = false; + StateHasChanged(); message = response.Message; } } diff --git a/BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor b/BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor index 91e5178..514c78b 100644 --- a/BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor +++ b/BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor @@ -49,4 +49,4 @@ Login
-
\ No newline at end of file +
diff --git a/BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor.cs b/BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor.cs index dd61b94..ff1a4cc 100644 --- a/BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor.cs +++ b/BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using BookStoreApp.Blazor.Server.UI.Services.Base; +using Microsoft.AspNetCore.Components.Forms; namespace BookStoreApp.Blazor.Server.UI.Pages.Users { @@ -21,17 +22,19 @@ private async Task HandleRegistration() { try { - // register the user then navigate to login page + // register the user await httpClient.RegisterAsync(RegistrationModel); navManager.NavigateTo("/users/login"); } catch (ApiException ex) { + // If any status code out of 200 if (ex.StatusCode >= 200 && ex.StatusCode <= 299) { navManager.NavigateTo("/users/login"); } message = ex.Response; + StateHasChanged(); } } } diff --git a/BookStoreApp.Blazor.Server.UI/Shared/MainLayout.razor b/BookStoreApp.Blazor.Server.UI/Shared/MainLayout.razor index 7e4294e..4b1b0b5 100644 --- a/BookStoreApp.Blazor.Server.UI/Shared/MainLayout.razor +++ b/BookStoreApp.Blazor.Server.UI/Shared/MainLayout.razor @@ -2,6 +2,7 @@ @* Required *@ + @* Needed for dialogs *@