MRB webassembly
This commit is contained in:
64
MesaFabApproval.Client/Program.cs
Normal file
64
MesaFabApproval.Client/Program.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using MesaFabApproval.Client;
|
||||
using MesaFabApproval.Client.Utilities;
|
||||
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
|
||||
using MudBlazor.Services;
|
||||
using MesaFabApproval.Client.Services;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using System.Net.Http.Headers;
|
||||
using MudBlazor;
|
||||
|
||||
WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
|
||||
string _apiBaseUrl = builder.Configuration["FabApprovalApiBaseUrl"] ??
|
||||
throw new NullReferenceException("FabApprovalApiBaseUrl not found in config");
|
||||
|
||||
builder.Services.AddTransient<ApiHttpClientHandler>();
|
||||
|
||||
builder.Services
|
||||
.AddHttpClient("API_Handler", client => {
|
||||
client.BaseAddress = new Uri(_apiBaseUrl);
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*"));
|
||||
});
|
||||
|
||||
builder.Services
|
||||
.AddHttpClient("API", client => {
|
||||
client.BaseAddress = new Uri(_apiBaseUrl);
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*"));
|
||||
})
|
||||
.AddHttpMessageHandler<ApiHttpClientHandler>();
|
||||
|
||||
builder.Services.AddMemoryCache();
|
||||
|
||||
builder.Services.AddMudServices(config => {
|
||||
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomCenter;
|
||||
config.SnackbarConfiguration.PreventDuplicates = true;
|
||||
config.SnackbarConfiguration.MaxDisplayedSnackbars = 5;
|
||||
config.SnackbarConfiguration.SnackbarVariant = Variant.Filled;
|
||||
config.SnackbarConfiguration.ShowCloseIcon = true;
|
||||
config.SnackbarConfiguration.VisibleStateDuration = 7000;
|
||||
config.SnackbarConfiguration.HideTransitionDuration = 500;
|
||||
config.SnackbarConfiguration.ShowTransitionDuration = 500;
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<ILocalStorageService, LocalStorageService>();
|
||||
builder.Services.AddScoped<IAuthenticationService, AuthenticationService>();
|
||||
builder.Services.AddScoped<ICustomerService, CustomerService>();
|
||||
builder.Services.AddScoped<IUserService, UserService>();
|
||||
builder.Services.AddScoped<IECNService, ECNService>();
|
||||
builder.Services.AddScoped<ICAService, CAService>();
|
||||
builder.Services.AddScoped<IPCRBService, PCRBService>();
|
||||
builder.Services.AddScoped<IMRBService, MRBService>();
|
||||
builder.Services.AddScoped<IApprovalService, ApprovalService>();
|
||||
builder.Services.AddScoped<MesaFabApprovalAuthStateProvider>();
|
||||
builder.Services.AddScoped<AuthenticationStateProvider>(sp =>
|
||||
sp.GetRequiredService<MesaFabApprovalAuthStateProvider>());
|
||||
|
||||
builder.Services.AddAuthorizationCore();
|
||||
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
await builder.Build().RunAsync();
|
Reference in New Issue
Block a user