🐛 Fix search with tag won't work

This commit is contained in:
2024-07-26 01:31:45 +08:00
parent a5b6ace79b
commit 0237409d27
3 changed files with 13 additions and 12 deletions

View File

@@ -9,12 +9,10 @@ class PostProvider extends GetConnect {
}
Future<Response> listRecommendations(int page,
{int? realm, String? tag, category, String? channel}) async {
{int? realm, String? channel}) async {
final queries = [
'take=${10}',
'offset=$page',
if (tag != null) 'tag=$tag',
if (category != null) 'category=$category',
if (realm != null) 'realmId=$realm',
];
final resp = await get(
@@ -46,10 +44,13 @@ class PostProvider extends GetConnect {
return resp;
}
Future<Response> listPost(int page, {int? realm}) async {
Future<Response> listPost(int page,
{int? realm, String? tag, category}) async {
final queries = [
'take=${10}',
'offset=$page',
if (tag != null) 'tag=$tag',
if (category != null) 'category=$category',
if (realm != null) 'realmId=$realm',
];
final resp = await get('/posts?${queries.join('&')}');

View File

@@ -26,7 +26,7 @@ class _FeedSearchScreenState extends State<FeedSearchScreen> {
Response resp;
try {
resp = await provider.listRecommendations(
resp = await provider.listPost(
pageKey,
tag: widget.tag,
category: widget.category,