- Changed NavMenu to link to /dashboards instead of /dashboards/default - Refactored Dashboard.razor to list dashboards from API - Dashboard viewer/designer now loads by selected dashboard ID - Mode toggle preserves selected dashboard and mode - Added DashboardApiClient and DashboardInfoDto for API integration - Registered DashboardApiClient for DI and HTTP client setup in Program.cs
50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using DbFirst.BlazorWebApp.Components;
|
|
using DbFirst.BlazorWebApp.Services;
|
|
using DevExpress.Blazor;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
|
|
builder.Services.AddDevExpressBlazor();
|
|
|
|
var apiBaseUrl = builder.Configuration["ApiBaseUrl"];
|
|
if (!string.IsNullOrWhiteSpace(apiBaseUrl))
|
|
{
|
|
builder.Services.AddHttpClient<CatalogApiClient>(client =>
|
|
{
|
|
client.BaseAddress = new Uri(apiBaseUrl);
|
|
});
|
|
builder.Services.AddHttpClient<DashboardApiClient>(client =>
|
|
{
|
|
client.BaseAddress = new Uri(apiBaseUrl);
|
|
});
|
|
}
|
|
else
|
|
{
|
|
builder.Services.AddHttpClient<CatalogApiClient>();
|
|
builder.Services.AddHttpClient<DashboardApiClient>();
|
|
}
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseStaticFiles();
|
|
app.UseAntiforgery();
|
|
|
|
app.MapRazorComponents<App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
app.Run();
|