2022-09-04 19:19:42 +02:00
|
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
|
|
using MudBlazor.Services;
|
|
|
|
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
|
|
builder.RootComponents.Add<App>("#app");
|
|
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
|
|
|
2022-09-09 14:31:45 +02:00
|
|
|
builder.Services.AddSingleton(sp => new HttpClient
|
2022-09-04 19:19:42 +02:00
|
|
|
{
|
|
|
|
BaseAddress = new Uri(builder.Configuration.GetValue<string>("BaseUrl"))
|
|
|
|
});
|
|
|
|
builder.Services.AddMudServices();
|
2022-09-09 14:31:45 +02:00
|
|
|
builder.Services.AddSingleton<IGameDataService, GameDataService>();
|
2022-09-04 19:19:42 +02:00
|
|
|
|
2022-09-09 14:31:45 +02:00
|
|
|
var host = builder.Build();
|
|
|
|
|
|
|
|
var gameDataService = host.Services.GetRequiredService<IGameDataService>();
|
2022-09-09 19:27:20 +02:00
|
|
|
#if DEBUG
|
2022-09-09 14:31:45 +02:00
|
|
|
await gameDataService.InitializeAsync(builder.Configuration.GetValue<string>("DataBaseUrl"));
|
2022-09-09 19:27:20 +02:00
|
|
|
#else
|
|
|
|
await gameDataService.InitializeAsync(builder.Configuration.GetValue<string>("BaseUrl"));
|
|
|
|
#endif
|
2022-09-09 14:31:45 +02:00
|
|
|
|
|
|
|
await host.RunAsync();
|