Add CancellationToken support to all API client methods
All API client interfaces and implementations now accept an optional CancellationToken parameter for each method. This enables consumers to cancel HTTP requests, improving responsiveness and resource management. No changes were made to core logic or return types; only method signatures and HttpClient calls were updated to support cancellation.
This commit is contained in:
@@ -13,9 +13,9 @@ public class DashboardApiClient : IDashboardApiClient
|
||||
_httpClient = httpClient;
|
||||
}
|
||||
|
||||
public async Task<List<DashboardInfoDto>> GetAllAsync()
|
||||
public async Task<List<DashboardInfoDto>> GetAllAsync(CancellationToken ct = default)
|
||||
{
|
||||
var result = await _httpClient.GetFromJsonAsync<List<DashboardInfoDto>>(Endpoint);
|
||||
var result = await _httpClient.GetFromJsonAsync<List<DashboardInfoDto>>(Endpoint, ct);
|
||||
return result ?? new List<DashboardInfoDto>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user