♻️ Refactored explore page

This commit is contained in:
2025-02-22 14:52:58 +08:00
parent edd86eda77
commit ea9ef9e82a
6 changed files with 413 additions and 109 deletions

View File

@ -127,6 +127,7 @@ class SnPostContentProvider {
Iterable<String>? categories,
Iterable<String>? tags,
String? realm,
String? channel,
}) async {
final resp = await _sn.client.get('/cgi/co/posts', queryParameters: {
'take': take,
@ -136,6 +137,7 @@ class SnPostContentProvider {
if (tags?.isNotEmpty ?? false) 'tags': tags!.join(','),
if (categories?.isNotEmpty ?? false) 'categories': categories!.join(','),
if (realm != null) 'realm': realm,
if (channel != null) 'channel': channel,
});
final List<SnPost> out = await _preloadRelatedDataInBatch(
List.from(resp.data['data']?.map((e) => SnPost.fromJson(e)) ?? []),