Basic publisher page

This commit is contained in:
2024-12-01 22:30:32 +08:00
parent 32739821ba
commit 23c5a1a23e
10 changed files with 347 additions and 21 deletions

View File

@ -63,10 +63,15 @@ class SnPostContentProvider {
return out;
}
Future<(List<SnPost>, int)> listPosts({int take = 10, int offset = 0}) async {
Future<(List<SnPost>, int)> listPosts({
int take = 10,
int offset = 0,
String? author,
}) async {
final resp = await _sn.client.get('/cgi/co/posts', queryParameters: {
'take': take,
'offset': offset,
if (author != null) 'author': author,
});
final List<SnPost> out = await _preloadRelatedDataInBatch(
List.from(resp.data['data']?.map((e) => SnPost.fromJson(e)) ?? []),