From 1f19933c23dbb39ed4fc197f96a10a27e101626e Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Fri, 18 Dec 2020 21:40:42 -0500 Subject: [PATCH] Complete NodaTime conversion also delete default pages --- .../Client/JobsJobsJobs.Client.csproj | 5 +- .../Client/Pages/Citizen/Dashboard.razor | 1 + src/JobsJobsJobs/Client/Pages/Counter.razor | 16 ------- src/JobsJobsJobs/Client/Pages/FetchData.razor | 46 ------------------- src/JobsJobsJobs/Client/Program.cs | 4 ++ src/JobsJobsJobs/Client/Shared/NavMenu.razor | 6 +++ .../Controllers/WeatherForecastController.cs | 40 ---------------- .../Server/JobsJobsJobs.Server.csproj | 5 ++ src/JobsJobsJobs/Server/Startup.cs | 6 ++- .../Shared/JobsJobsJobs.Shared.csproj | 2 +- src/JobsJobsJobs/Shared/WeatherForecast.cs | 17 ------- 11 files changed, 25 insertions(+), 123 deletions(-) delete mode 100644 src/JobsJobsJobs/Client/Pages/Counter.razor delete mode 100644 src/JobsJobsJobs/Client/Pages/FetchData.razor delete mode 100644 src/JobsJobsJobs/Server/Controllers/WeatherForecastController.cs delete mode 100644 src/JobsJobsJobs/Shared/WeatherForecast.cs diff --git a/src/JobsJobsJobs/Client/JobsJobsJobs.Client.csproj b/src/JobsJobsJobs/Client/JobsJobsJobs.Client.csproj index b231dcb..ce2a994 100644 --- a/src/JobsJobsJobs/Client/JobsJobsJobs.Client.csproj +++ b/src/JobsJobsJobs/Client/JobsJobsJobs.Client.csproj @@ -6,9 +6,10 @@ - - + + + diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor index 0b21952..bfa6ba2 100644 --- a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor +++ b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor @@ -41,6 +41,7 @@ else { errorMessage = profileResult.Error; } + retrievingProfile = false; } } } diff --git a/src/JobsJobsJobs/Client/Pages/Counter.razor b/src/JobsJobsJobs/Client/Pages/Counter.razor deleted file mode 100644 index 8641f78..0000000 --- a/src/JobsJobsJobs/Client/Pages/Counter.razor +++ /dev/null @@ -1,16 +0,0 @@ -@page "/counter" - -

Counter

- -

Current count: @currentCount

- - - -@code { - private int currentCount = 0; - - private void IncrementCount() - { - currentCount++; - } -} diff --git a/src/JobsJobsJobs/Client/Pages/FetchData.razor b/src/JobsJobsJobs/Client/Pages/FetchData.razor deleted file mode 100644 index 84c59e5..0000000 --- a/src/JobsJobsJobs/Client/Pages/FetchData.razor +++ /dev/null @@ -1,46 +0,0 @@ -@page "/fetchdata" -@using JobsJobsJobs.Shared -@inject HttpClient Http - -

Weather forecast

- -

This component demonstrates fetching data from the server.

- -@if (forecasts == null) -{ -

Loading...

-} -else -{ - - - - - - - - - - - @foreach (var forecast in forecasts) - { - - - - - - - } - -
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
-} - -@code { - private WeatherForecast[] forecasts; - - protected override async Task OnInitializedAsync() - { - forecasts = await Http.GetFromJsonAsync("WeatherForecast"); - } - -} diff --git a/src/JobsJobsJobs/Client/Program.cs b/src/JobsJobsJobs/Client/Program.cs index 4adaa42..b7c2c9d 100644 --- a/src/JobsJobsJobs/Client/Program.cs +++ b/src/JobsJobsJobs/Client/Program.cs @@ -2,10 +2,13 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using NodaTime; +using NodaTime.Serialization.SystemTextJson; using System; using System.Collections.Generic; using System.Net.Http; using System.Text; +using System.Text.Json; using System.Threading.Tasks; namespace JobsJobsJobs.Client @@ -19,6 +22,7 @@ namespace JobsJobsJobs.Client builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Services.AddSingleton(new AppState()); + builder.Services.AddSingleton(new JsonSerializerOptions().ConfigureForNodaTime(DateTimeZoneProviders.Tzdb)); await builder.Build().RunAsync(); } } diff --git a/src/JobsJobsJobs/Client/Shared/NavMenu.razor b/src/JobsJobsJobs/Client/Shared/NavMenu.razor index d0fc6c4..ff92828 100644 --- a/src/JobsJobsJobs/Client/Shared/NavMenu.razor +++ b/src/JobsJobsJobs/Client/Shared/NavMenu.razor @@ -1,5 +1,6 @@ @inject AppState state @inject NavigationManager nav +@implements IDisposable