mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 04:58:41 +00:00
feat: create vote (#871)
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -917,4 +917,8 @@ class Api {
|
||||
static const String spaceAudio = '/audio/music-service/web/song/upper';
|
||||
|
||||
static const String dynMention = '/x/polymer/web-dynamic/v1/mention/search';
|
||||
|
||||
static const String createVote = '/x/vote/create';
|
||||
|
||||
static const String updateVote = '/x/vote/update';
|
||||
}
|
||||
|
||||
@@ -510,4 +510,30 @@ class DynamicsHttp {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<int?>> createVote(VoteInfo voteInfo) async {
|
||||
final res = await Request().post(
|
||||
Api.createVote,
|
||||
queryParameters: {'csrf': Accounts.main.csrf},
|
||||
data: {'vote_info': voteInfo.toJson()},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return Success(res.data['data']?['vote_id']);
|
||||
} else {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<int?>> updateVote(VoteInfo voteInfo) async {
|
||||
final res = await Request().post(
|
||||
Api.updateVote,
|
||||
queryParameters: {'csrf': Accounts.main.csrf},
|
||||
data: {'vote_info': voteInfo.toJson()},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return Success(res.data['data']?['vote_id']);
|
||||
} else {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class MsgHttp {
|
||||
}
|
||||
|
||||
static Future uploadBfs({
|
||||
dynamic path,
|
||||
required String path,
|
||||
String? category,
|
||||
String? biz,
|
||||
CancelToken? cancelToken,
|
||||
|
||||
Reference in New Issue
Block a user