Files
astrain/src/ASTRAIN.Client/Program.cs
2026-01-29 10:17:26 +01:00

20 lines
700 B
C#

using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using ASTRAIN.Client;
using ASTRAIN.Client.Services;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
var apiBaseAddress = builder.Configuration["ApiBaseAddress"];
var baseAddress = string.IsNullOrWhiteSpace(apiBaseAddress)
? builder.HostEnvironment.BaseAddress
: apiBaseAddress;
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(baseAddress) });
builder.Services.AddScoped<ApiClient>();
builder.Services.AddScoped<UserContext>();
await builder.Build().RunAsync();