Skip to content

Commit 1d05c3c

Browse files
committed
fix(dashboard): correct API call for fetching recent headlines
Moves the `sortBy` and `sortOrder` parameters from the `query` map to the dedicated named arguments in the `readAllBy` method call within the `DashboardBloc`. This aligns the call with the repository's API contract and resolves the `BadRequestException` thrown by the `HtDataInMemory` client, which was incorrectly receiving sorting parameters as filter keys.
1 parent b517c0a commit 1d05c3c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/dashboard/bloc/dashboard_bloc.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ class DashboardBloc extends Bloc<DashboardEvent, DashboardState> {
3838
] = await Future.wait([
3939
_dashboardSummaryRepository.read(id: 'summary'),
4040
_appConfigRepository.read(id: 'app_config'),
41-
_headlinesRepository.readAllByQuery(
42-
const {'sortBy': 'createdAt', 'sortOrder': 'desc'},
41+
_headlinesRepository.readAll(
42+
sortBy: 'createdAt',
43+
sortOrder: SortOrder.desc,
4344
limit: 5,
4445
),
4546
]);

0 commit comments

Comments
 (0)