using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.AspNetCore.Components.Web; using phronCare.UIBlazor.Services.Authorization; using phronCare.UIBlazor; using phronCare.UIBlazor.Services.UI; using Blazored.Modal; using Blazored.Toast; using phronCare.UIBlazor.Services.Tickets; using phronCare.UIBlazor.Shared; using phronCare.UIBlazor.Services.Sales; var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); #region Proveedor de Autorizacion builder.Services.AddScoped(); builder.Services.AddScoped(p => p.GetRequiredService()); builder.Services.AddScoped(p => p.GetRequiredService()); builder.Services.AddAuthorizationCore(); #endregion #region Load Configuration //var apiBaseUrl = Environment.GetEnvironmentVariable("API_BASE_URL") // ?? builder.Configuration.GetSection("BaseAd").Value; //if (!string.IsNullOrEmpty(apiBaseUrl) && Uri.TryCreate(apiBaseUrl, UriKind.Absolute, out var validUri)) //{ // builder.Services.AddScoped(sp => new HttpClient { BaseAddress = validUri }); //} //Console.WriteLine($" valor apiBaseUrl: {apiBaseUrl}"); var config = builder.Configuration.GetSection("BaseAd").Value; if (config != null) { builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(config) }); } #endregion #region Injection Dependencis builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); #endregion #region UI builder.Services.AddBlazoredModal(); builder.Services.AddBlazoredToast(); builder.Services.AddSingleton(); #endregion await builder.Build().RunAsync();