Skip to content

Commit

Permalink
Added mudpopover provider
Browse files Browse the repository at this point in the history
  • Loading branch information
sethpulsipher committed Oct 24, 2024
1 parent dac5064 commit 0e4ad17
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion BookStoreApp.API/BookStoreApp.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.6" />
<PackageReference Include="Serilog" Version="4.0.2" />
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
Expand Down
43 changes: 21 additions & 22 deletions BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,28 @@
<h3>Login</h3>


<EditForm Model="LoginModel" OnValidSubmit="HandleLogin">
<DataAnnotationsValidator />
<ValidationSummary />
<EditForm Model="LoginModel" OnValidSubmit="HandleLogin">
<DataAnnotationsValidator />
<ValidationSummary />

<div class="mb-3">
<label for="email">Email Address</label>
<InputText class="form-control" @bind-Value="LoginModel.Email" id="email" />
<ValidationMessage For="@(() => LoginModel.Email)" />
</div>
<div class="mb-3">
<label for="email">Email Address</label>
<InputText class="form-control" @bind-Value="LoginModel.Email" id="email" />
<ValidationMessage For="@(() => LoginModel.Email)" />
</div>

<div class="mb-4">
<label for="password">Password</label>
<InputText class="form-control" type="password" @bind-Value="LoginModel.Password" id="password" />
<ValidationMessage For="@(() => LoginModel.Password)" />
</div>
<div class="mb-4">
<label for="password">Password</label>
<InputText class="form-control" type="password" @bind-Value="LoginModel.Password" id="password" />
<ValidationMessage For="@(() => LoginModel.Password)" />
</div>

<div class="d-flex gap-3 align-items-center">
<div>
<SubmitButton loadingVar="_loading"></SubmitButton>
</div>
<div>
<a class="btn btn-link" href="/users/register">Sign Up</a>
</div>
<div class="d-flex gap-3 align-items-center">
<div>
<SubmitButton loadingVar="_loading"></SubmitButton>
</div>

</EditForm>
<div>
<a class="btn btn-link" href="/users/register">Sign Up</a>
</div>
</div>
</EditForm>
2 changes: 2 additions & 0 deletions BookStoreApp.Blazor.Server.UI/Pages/Users/Login.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ private async Task HandleLogin()
navManager.NavigateTo("/");
}


_loading = false;
StateHasChanged();
message = response.Message;
}
}
Expand Down
2 changes: 1 addition & 1 deletion BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
<a class="btn btn-link" href="/users/login">Login</a>
</div>
</div>
</EditForm>
</EditForm>
5 changes: 4 additions & 1 deletion BookStoreApp.Blazor.Server.UI/Pages/Users/Register.razor.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions BookStoreApp.Blazor.Server.UI/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

@* Required *@
<MudThemeProvider />
<MudPopoverProvider />

@* Needed for dialogs *@
<MudDialogProvider />
Expand Down

0 comments on commit 0e4ad17

Please sign in to comment.