35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using FilterCair.Client;
|
|
using FilterCair.Client.Services;
|
|
using FilterCair.Client.Services.API;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
builder.RootComponents.Add<App>("#app");
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
|
|
builder.Services.AddHttpClient("FilterCair.ServerAPI", client =>
|
|
client.BaseAddress = new Uri(builder.Configuration["Api:BaseUrl"] ?? "https://localhost:7010"))
|
|
.AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>();
|
|
|
|
builder.Services.AddScoped(sp =>
|
|
sp.GetRequiredService<IHttpClientFactory>().CreateClient("FilterCair.ServerAPI"));
|
|
|
|
builder.Services.AddMsalAuthentication(options =>
|
|
{
|
|
builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
|
|
options.ProviderOptions.DefaultAccessTokenScopes.Add(
|
|
"api://54b010c7-4a9a-4f2d-bea3-9faba3f12495/API.Access");
|
|
});
|
|
|
|
//Services
|
|
builder.Services.AddScoped<AppState>();
|
|
|
|
//API Services
|
|
builder.Services.AddScoped<CustomerService>();
|
|
builder.Services.AddScoped<StationService>();
|
|
builder.Services.AddScoped<FilterService>();
|
|
|
|
await builder.Build().RunAsync();
|