🐛 Fix search with tag won't work

This commit is contained in:
LittleSheep 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, Future<Response> listRecommendations(int page,
{int? realm, String? tag, category, String? channel}) async { {int? realm, String? channel}) async {
final queries = [ final queries = [
'take=${10}', 'take=${10}',
'offset=$page', 'offset=$page',
if (tag != null) 'tag=$tag',
if (category != null) 'category=$category',
if (realm != null) 'realmId=$realm', if (realm != null) 'realmId=$realm',
]; ];
final resp = await get( final resp = await get(
@ -46,10 +44,13 @@ class PostProvider extends GetConnect {
return resp; return resp;
} }
Future<Response> listPost(int page, {int? realm}) async { Future<Response> listPost(int page,
{int? realm, String? tag, category}) async {
final queries = [ final queries = [
'take=${10}', 'take=${10}',
'offset=$page', 'offset=$page',
if (tag != null) 'tag=$tag',
if (category != null) 'category=$category',
if (realm != null) 'realmId=$realm', if (realm != null) 'realmId=$realm',
]; ];
final resp = await get('/posts?${queries.join('&')}'); final resp = await get('/posts?${queries.join('&')}');

View File

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

View File

@ -76,7 +76,7 @@ PODS:
- GoogleUtilities/UserDefaults (7.13.3): - GoogleUtilities/UserDefaults (7.13.3):
- GoogleUtilities/Logger - GoogleUtilities/Logger
- GoogleUtilities/Privacy - GoogleUtilities/Privacy
- livekit_client (2.2.1): - livekit_client (2.2.2):
- FlutterMacOS - FlutterMacOS
- WebRTC-SDK (= 125.6422.04) - WebRTC-SDK (= 125.6422.04)
- macos_window_utils (1.0.0): - macos_window_utils (1.0.0):
@ -104,11 +104,11 @@ PODS:
- FlutterMacOS - FlutterMacOS
- screen_brightness_macos (0.1.0): - screen_brightness_macos (0.1.0):
- FlutterMacOS - FlutterMacOS
- Sentry/HybridSDK (8.30.1) - Sentry/HybridSDK (8.32.0)
- sentry_flutter (8.4.0): - sentry_flutter (8.5.0):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- Sentry/HybridSDK (= 8.30.1) - Sentry/HybridSDK (= 8.32.0)
- sqflite (0.0.3): - sqflite (0.0.3):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
@ -222,7 +222,7 @@ SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
livekit_client: b8dc024da36a5c1103b6ccdcfb5bb7776a1ee6a1 livekit_client: c24af2b8474a39325596e714118e05551ec5eacc
macos_window_utils: 933f91f64805e2eb91a5bd057cf97cd097276663 macos_window_utils: 933f91f64805e2eb91a5bd057cf97cd097276663
media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82 media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82
media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5 media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5
@ -234,8 +234,8 @@ SPEC CHECKSUMS:
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
protocol_handler_macos: d10a6c01d6373389ffd2278013ab4c47ed6d6daa protocol_handler_macos: d10a6c01d6373389ffd2278013ab4c47ed6d6daa
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
Sentry: 514a3ea653886e9a48c6287d8b7bf05ec24bf3be Sentry: 96ae1dcdf01a644bc3a3b1dc279cecaf48a833fb
sentry_flutter: edc037f7af0dc1512d6c33a5c2c7c838bd0d6806 sentry_flutter: f1d86adcb93a959bc47a40d8d55059bdf7569bc5
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399 url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269 wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269