Leandro Hernan Rojas 2b456f1e47
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 8m54s
Update UI Add ProductForm v1
2025-04-19 12:56:35 -03:00

56 lines
2.1 KiB
C#

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>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
#region Proveedor de Autorizacion
builder.Services.AddScoped<CustomAuthorizationProvider>();
builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthorizationProvider>(p => p.GetRequiredService<CustomAuthorizationProvider>());
builder.Services.AddScoped<ILoginService, CustomAuthorizationProvider>(p => p.GetRequiredService<CustomAuthorizationProvider>());
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<TicketsService>();
builder.Services.AddScoped<CustomerService>();
builder.Services.AddScoped<TaxConditionService>();
builder.Services.AddScoped<AccountTypeService>();
builder.Services.AddScoped<ProductService>();
builder.Services.AddScoped<BusinessUnitService>();
builder.Services.AddScoped<ProductCategoryService>();
#endregion
#region UI
builder.Services.AddBlazoredModal();
builder.Services.AddBlazoredToast();
builder.Services.AddSingleton<NavMenuService>();
#endregion
await builder.Build().RunAsync();