Files
DbFirst/DbFirst.BlazorWebApp/Services/DashboardApiClient.cs
OlgunR 45011122b2 Refactor API clients to use primary constructor for HttpClient
Refactored CatalogApiClient, DashboardApiClient, LayoutApiClient, and MassDataApiClient to use C# primary constructor syntax for injecting HttpClient. Removed private _httpClient fields and updated all usages to reference the constructor parameter directly. This change simplifies the code and modernizes dependency injection without altering any API logic.
2026-05-11 17:08:52 +02:00

15 lines
450 B
C#

using DbFirst.Contracts.Dashboards;
namespace DbFirst.BlazorWebApp.Services;
public class DashboardApiClient(HttpClient httpClient) : IDashboardApiClient
{
private const string Endpoint = "api/dashboard/dashboards";
public async Task<List<DashboardInfoDto>> GetAllAsync(CancellationToken ct = default)
{
var result = await httpClient.GetFromJsonAsync<List<DashboardInfoDto>>(Endpoint, ct);
return result ?? [];
}
}