Inject framework HttpClient to support prerendering behavior on server instead of baking in the HttpClient on the client project
This commit is contained in:
@@ -4,8 +4,11 @@ using MudBlazor.Services;
|
||||
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
|
||||
Console.WriteLine(builder.HostEnvironment.BaseAddress);
|
||||
builder.Services.AddScoped<HttpClient>(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
|
||||
builder.Services.AddMudServices();
|
||||
|
||||
Startup.ConfigureDomainServices(builder.Services, builder.HostEnvironment.BaseAddress);
|
||||
Startup.ConfigureDomainServices(builder.Services);
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
|
||||
Reference in New Issue
Block a user