dyn topic fold

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-07-06 12:22:27 +08:00
parent 5e1c73abc1
commit aa03eed92d
13 changed files with 184 additions and 97 deletions

View File

@@ -471,10 +471,35 @@ abstract final class DynamicsHttp {
},
);
if (res.data['code'] == 0) {
TopicCardList? data = res.data['data']?['topic_card_list'] == null
? null
: TopicCardList.fromJson(res.data['data']['topic_card_list']);
return Success(data);
final list = res.data['data']?['topic_card_list'];
if (list == null) {
return const Success(null);
} else {
return Success(TopicCardList.fromJson(list));
}
} else {
return Error(res.data['message']);
}
}
static Future<LoadingState<TopicCardList?>> topicFold({
required Object topicId,
required int sortBy,
}) async {
final res = await Request().get(
Api.topicFold,
queryParameters: {
'topic_id': topicId,
'sort_by': sortBy,
},
);
if (res.data['code'] == 0) {
final list = res.data['data']?['topic_card_list'];
if (list == null) {
return const Success(null);
} else {
return Success(TopicCardList.fromJson(list));
}
} else {
return Error(res.data['message']);
}