Добавьте файлы проекта.
This commit is contained in:
41
PlaylistShared.Pwa/Program.cs
Normal file
41
PlaylistShared.Pwa/Program.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using MudBlazor.Services;
|
||||
using PlaylistShared.Pwa;
|
||||
using PlaylistShared.Pwa.Services;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
private static async global::System.Threading.Tasks.Task Main(string[] args)
|
||||
{
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
builder.Services.AddMudServices();
|
||||
builder.Services.AddScoped(sp =>
|
||||
{
|
||||
var apiUrl = builder.Configuration["ApiBaseUrl"] ?? builder.HostEnvironment.BaseAddress;
|
||||
return new HttpClient { BaseAddress = new Uri(apiUrl) };
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<TokenStorage>();
|
||||
builder.Services.AddScoped<AuthStateProvider>();
|
||||
builder.Services.AddScoped<AuthenticationStateProvider>(sp => sp.GetRequiredService<AuthStateProvider>());
|
||||
builder.Services.AddScoped<ApiClient>();
|
||||
|
||||
/*
|
||||
builder.Services.AddOidcAuthentication(options =>
|
||||
{
|
||||
// Configure your authentication provider options here.
|
||||
// For more information, see https://aka.ms/blazor-standalone-auth
|
||||
builder.Configuration.Bind("Local", options.ProviderOptions);
|
||||
});
|
||||
*/
|
||||
builder.Services.AddAuthorizationCore();
|
||||
builder.Services.AddCascadingAuthenticationState();
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user