Refactor API base URL config to use AppSettings class

Replaced direct IConfiguration usage with a strongly-typed AppSettings class for accessing the API base URL. Registered AppSettings with DI and updated Dashboard.razor to use IOptions<AppSettings>. Updated using statements and DI setup for improved type safety and centralized configuration management.
This commit is contained in:
OlgunR
2026-04-20 11:32:45 +02:00
parent cd0a824064
commit 27c8f92a3b
4 changed files with 14 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
using DbFirst.BlazorWebApp;
using DbFirst.BlazorWebApp.Components;
using DbFirst.BlazorWebApp.Services;
using DevExpress.Blazor;
@@ -13,6 +14,7 @@ builder.Services.AddScoped<ThemeState>();
builder.Services.AddScoped<BandLayoutService>();
var apiBaseUrl = builder.Configuration["ApiBaseUrl"];
builder.Services.Configure<AppSettings>(builder.Configuration);
void ConfigureClient(HttpClient client)
{
if (!string.IsNullOrWhiteSpace(apiBaseUrl))