diff --git a/BeauFindlay/src/BeauFindlay.Client/Program.cs b/BeauFindlay/src/BeauFindlay.Client/Program.cs index 35091e5..8dcd37c 100644 --- a/BeauFindlay/src/BeauFindlay.Client/Program.cs +++ b/BeauFindlay/src/BeauFindlay.Client/Program.cs @@ -7,10 +7,18 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); -var apiBase = builder.Configuration["ApiBase"] +string apiBase; +if (builder.HostEnvironment.IsDevelopment()) +{ + apiBase = builder.Configuration["ApiBase"] ?? throw new ArgumentException("API base address not found in config."); +} +else +{ + apiBase = builder.HostEnvironment.BaseAddress; +} -builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); +builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(apiBase) }); builder.Services.AddSingleton(); diff --git a/BeauFindlay/src/BeauFindlay.Client/wwwroot/index.html b/BeauFindlay/src/BeauFindlay.Client/wwwroot/index.html index 4b260d3..92a81b4 100644 --- a/BeauFindlay/src/BeauFindlay.Client/wwwroot/index.html +++ b/BeauFindlay/src/BeauFindlay.Client/wwwroot/index.html @@ -26,7 +26,6 @@ -