| | | 1 | | using Microsoft.AspNetCore.Components.Web; |
| | | 2 | | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; |
| | | 3 | | using Microsoft.Extensions.Options; |
| | | 4 | | using RaidLoop.Client; |
| | | 5 | | using RaidLoop.Client.Configuration; |
| | | 6 | | using RaidLoop.Client.Services; |
| | | 7 | | |
| | 0 | 8 | | var builder = WebAssemblyHostBuilder.CreateDefault(args); |
| | 0 | 9 | | builder.RootComponents.Add<App>("#app"); |
| | 0 | 10 | | builder.RootComponents.Add<HeadOutlet>("head::after"); |
| | | 11 | | |
| | 0 | 12 | | builder.Services.AddLocalization(options => options.ResourcesPath = "Resources"); |
| | 0 | 13 | | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); |
| | 0 | 14 | | builder.Services.Configure<SupabaseOptions>(builder.Configuration.GetSection(SupabaseOptions.SectionName)); |
| | 0 | 15 | | builder.Services.AddScoped<SupabaseAuthService>(); |
| | 0 | 16 | | builder.Services.AddScoped<IClientTelemetryService, ClientTelemetryService>(); |
| | 0 | 17 | | builder.Services.AddScoped<ISupabaseSessionProvider>(sp => sp.GetRequiredService<SupabaseAuthService>()); |
| | 0 | 18 | | builder.Services.AddScoped<IProfileApiClient>(sp => |
| | 0 | 19 | | { |
| | 0 | 20 | | var options = sp.GetRequiredService<IOptions<SupabaseOptions>>().Value; |
| | 0 | 21 | | return new ProfileApiClient( |
| | 0 | 22 | | new HttpClient |
| | 0 | 23 | | { |
| | 0 | 24 | | BaseAddress = new Uri($"{options.Url.TrimEnd('/')}/functions/v1/") |
| | 0 | 25 | | }, |
| | 0 | 26 | | sp.GetRequiredService<ISupabaseSessionProvider>(), |
| | 0 | 27 | | options); |
| | 0 | 28 | | }); |
| | 0 | 29 | | builder.Services.AddScoped<IGameActionApiClient>(sp => |
| | 0 | 30 | | { |
| | 0 | 31 | | var options = sp.GetRequiredService<IOptions<SupabaseOptions>>().Value; |
| | 0 | 32 | | return new GameActionApiClient( |
| | 0 | 33 | | new HttpClient |
| | 0 | 34 | | { |
| | 0 | 35 | | BaseAddress = new Uri($"{options.Url.TrimEnd('/')}/functions/v1/") |
| | 0 | 36 | | }, |
| | 0 | 37 | | sp.GetRequiredService<ISupabaseSessionProvider>(), |
| | 0 | 38 | | options); |
| | 0 | 39 | | }); |
| | | 40 | | |
| | 0 | 41 | | await builder.Build().RunAsync(); |