Fix toasts (#13)

This commit is contained in:
Daniel J. Summers 2021-03-16 11:34:58 -04:00
parent d6f4628e1c
commit 9e9b519c25
3 changed files with 23 additions and 10 deletions

View File

@ -25,9 +25,19 @@
</div> </div>
</div> </div>
</div> </div>
@if (InitToasts)
{
<BlazoredToasts Position="ToastPosition.BottomRight" <BlazoredToasts Position="ToastPosition.BottomRight"
ShowProgressBar="true" /> ShowProgressBar="true" />
}
@code { @code {
bool InitToasts = false;
async void PlayJobs() => await js.InvokeVoidAsync("Audio.play", "pelosijobs"); async void PlayJobs() => await js.InvokeVoidAsync("Audio.play", "pelosijobs");
protected override void OnAfterRender(bool firstRender)
{
base.OnAfterRender(firstRender);
if (!InitToasts) InitToasts = true;
}
} }

View File

@ -13,6 +13,7 @@
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" /> <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" /> <link href="css/app.css" rel="stylesheet" />
<link href="JobsJobsJobs.Client.styles.css" rel="stylesheet" /> <link href="JobsJobsJobs.Client.styles.css" rel="stylesheet" />
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet">
</head> </head>
<body> <body>

View File

@ -1,3 +1,4 @@
using Blazored.Toast;
using JobsJobsJobs.Server.Data; using JobsJobsJobs.Server.Data;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
@ -43,6 +44,7 @@ namespace JobsJobsJobs.Server
services.AddRazorPages() services.AddRazorPages()
.AddJsonOptions(options => .AddJsonOptions(options =>
options.JsonSerializerOptions.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb)); options.JsonSerializerOptions.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb));
services.AddBlazoredToast();
services.AddAuthentication(options => services.AddAuthentication(options =>
{ {
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;