12345678910111213141516171819202122232425262728293031323334353637 |
- global using Microsoft.AspNetCore.Components.Authorization;
- using Blazored.LocalStorage;
- using Grpc.Net.Client;
- using Grpc.Net.Client.Web;
- using Microsoft.AspNetCore.Components;
- using Microsoft.AspNetCore.Components.Web;
- using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
- using NemAnBlazor;
- using NemAnBlazor.Services;
- using NemAnBlazor.Services.Interfaces;
-
- var builder = WebAssemblyHostBuilder.CreateDefault(args);
- builder.RootComponents.Add<App>("#app");
- builder.RootComponents.Add<HeadOutlet>("head::after");
-
- builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
-
- builder.Services.AddScoped(_ =>
- {
- var grpcWebHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler());
- var channel = GrpcChannel.ForAddress(builder.HostEnvironment.BaseAddress, new GrpcChannelOptions { HttpHandler = grpcWebHandler });
-
- return channel;
- });
- builder.Services.AddAuthorizationCore();
- //builder.Services.AddScoped<AuthenticationStateProvider, AuthClientService>();
-
- builder.Services.AddScoped<ITrackClientService, TrackClientService>();
- builder.Services.AddScoped<IAuthClientService, AuthClientService>();
- builder.Services.AddScoped<IStatsClientService, StatsClientService>();
- builder.Services.AddScoped<IIdentityClientService, IdentityClientService>();
- builder.Services.AddBlazoredLocalStorage();
- builder.Services.AddScoped<AuthenticationStateProvider, AuthClientService>();
- builder.Services.AddAuthorizationCore();
-
- await builder.Build().RunAsync();
|