fetchServiceShoporders works
This commit is contained in:
44
Client/Program.cs
Normal file
44
Client/Program.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using MudBlazor.Services;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
|
||||
namespace OI.Metrology.Client;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
private static async Task Main(string[] args)
|
||||
{
|
||||
WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
LoggingLevelSwitch levelSwitch = new();
|
||||
LoggerConfiguration loggerConfiguration = new();
|
||||
string? apiUrl = builder.Configuration["ApiUrl"];
|
||||
// _ = loggerConfiguration.WriteTo.BrowserConsole();
|
||||
// _ = loggerConfiguration.MinimumLevel.ControlledBy(levelSwitch);
|
||||
// _ = loggerConfiguration.Enrich.WithProperty("InstanceId", Guid.NewGuid().ToString("n"));
|
||||
// _ = loggerConfiguration.WriteTo.BrowserHttp($"{apiUrl}ingest", controlLevelSwitch: levelSwitch);
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
Serilog.ILogger log = Log.ForContext<Program>();
|
||||
try
|
||||
{
|
||||
if (apiUrl is null)
|
||||
throw new NullReferenceException(nameof(apiUrl));
|
||||
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
_ = builder.Services.AddScoped(serviceProvider => new HttpClient { BaseAddress = new Uri(apiUrl) });
|
||||
_ = builder.Services.AddMudServices();
|
||||
|
||||
log.Information("Building Web Host");
|
||||
WebAssemblyHost app = builder.Build();
|
||||
await app.RunAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Fatal(ex, "An exception occurred while creating the WASM host");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user