7 changed files
SampleApp | ||
Shared | ||
SimpleAuthView.razor + | ||
_Imports.razor | ||
Program.cs | ||
SampleApp.csproj | ||
SampleApp.UnitTests | ||
SampleApp.UnitTests.csproj | ||
SimpleAuthViewTests.cs + | ||
blazor-testhost.sln | ||
SimpleAuthView.razor
/SampleApp/Shared/SimpleAuthView.razor+15/SampleApp/Shared/SimpleAuthView.razor
Add comment 1 Plus <CascadingAuthenticationState>
Add comment 2 Plus <AuthorizeView>
Add comment 3 Plus <Authorized>
Add comment 4 Plus Authorized!
Add comment 5 Plus </Authorized>
Add comment 6 Plus <NotAuthorized>
Add comment 7 Plus Not authorized?
Add comment 8 Plus </NotAuthorized>
Add comment 9 Plus </AuthorizeView>
Add comment 10 Plus </CascadingAuthenticationState>
Add comment 11 Plus
Add comment 12 Plus @code {
Add comment 13 Plus
Add comment 14 Plus }
Add comment 15 Plus
Add comment 1 using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
Add comment 2 using Microsoft.Extensions.DependencyInjection;
Add comment 3 Plus using System;
Add comment 3 4 using System.Diagnostics.CodeAnalysis;
Add comment 5 Plus using System.Net.Http;
Add comment 4 6 using System.Threading.Tasks;
Add comment 5 7
Add comment 6 8 namespace SampleApp
Add comment 13 15 var builder = WebAssemblyHostBuilder.CreateDefault(args);
Add comment 14 16 builder.RootComponents.Add<App>("app");
Add comment 15 17
Add comment 16 Minus builder.Services.AddBaseAddressHttpClient();
Add comment 18 Plus builder.Services.AddSingleton(sp => new HttpClient
Add comment 19 Plus {
Add comment 20 Plus BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
Add comment 21 Plus });
Add comment 17 22
Add comment 18 23 await builder.Build().RunAsync();
Add comment 19 24 }
SampleApp.UnitTests.csproj
/SampleApp.UnitTests/SampleApp.UnitTests.csproj/SampleApp.UnitTests/SampleApp.UnitTests.csproj
SimpleAuthViewTests.cs
/SampleApp.UnitTests/SimpleAuthViewTests.cs/SampleApp.UnitTests/SimpleAuthViewTests.cs