From 06c1f9f37f6066f012db462f89c714d203c0b7bf Mon Sep 17 00:00:00 2001 From: antoc0der <1@DESKTOP-K1L8ND3> Date: Tue, 8 Oct 2024 21:29:54 +0400 Subject: [PATCH] =?UTF-8?q?lab6=20=D1=81=20=D0=BD=D0=B5=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=D1=8E=D1=89=D0=B5=D0=B9=20=D0=BF=D0=B0=D0=B3?= =?UTF-8?q?=D0=B8=D0=BD=D0=B0=D1=86=D0=B8=D0=B5=D0=B9=20=D0=B8=20=D0=B5?= =?UTF-8?q?=D1=89=D0=B5=20=D1=87=D0=B5=D0=BC=20=D1=82=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/data/repositories/bbc_repository.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/data/repositories/bbc_repository.dart b/lib/data/repositories/bbc_repository.dart index 44e9b13..ed6c349 100644 --- a/lib/data/repositories/bbc_repository.dart +++ b/lib/data/repositories/bbc_repository.dart @@ -22,14 +22,23 @@ class BbcRepository extends ApiInterface { int pageSize = 10, }) async { try { - final String url = '$_baseUrl/everything?q=$q&page=$page&pageSize=$pageSize$_apiKey'; + // final String url = '$_baseUrl/everything?q=$q&page=$page&pageSize=$pageSize$_apiKey'; + final String url = '$_baseUrl/everything'; + final Response response = await _dio.get>( url, - queryParameters: { + queryParameters: ( (q != null && !q.isEmpty) ? { 'q': q, 'page': page, 'pageSize': pageSize, - }, + 'apikey': 'b9848c2aa43e4a0ba12dfe925db8513c' + } : { + 'q': 'news', + 'page': page, + 'pageSize': pageSize, + 'apikey': 'b9848c2aa43e4a0ba12dfe925db8513c' + } + ) ); final NewsDto dto = NewsDto.fromJson(response.data as Map);