Update dashboard navigation and dynamic loading
- 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
This commit is contained in:
21
DbFirst.BlazorWasm/Services/DashboardApiClient.cs
Normal file
21
DbFirst.BlazorWasm/Services/DashboardApiClient.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Net.Http.Json;
|
||||
using DbFirst.BlazorWasm.Models;
|
||||
|
||||
namespace DbFirst.BlazorWasm.Services;
|
||||
|
||||
public class DashboardApiClient
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private const string Endpoint = "api/dashboard/dashboards";
|
||||
|
||||
public DashboardApiClient(HttpClient httpClient)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
}
|
||||
|
||||
public async Task<List<DashboardInfoDto>> GetAllAsync()
|
||||
{
|
||||
var result = await _httpClient.GetFromJsonAsync<List<DashboardInfoDto>>(Endpoint);
|
||||
return result ?? new List<DashboardInfoDto>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user