mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-28 12:08:40 +00:00
show reserve btn in space page
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -830,6 +830,10 @@ abstract final class Api {
|
||||
|
||||
static const String dynReserve = '/x/dynamic/feed/reserve/click';
|
||||
|
||||
static const String spaceReserve = '/x/space/reserve';
|
||||
|
||||
static const String spaceReserveCancel = '/x/space/reserve/cancel';
|
||||
|
||||
static const String favPugv = '/pugv/app/web/favorite/page';
|
||||
|
||||
static const String addFavPugv = '/pugv/app/web/favorite/add';
|
||||
|
||||
@@ -571,4 +571,23 @@ abstract final class UserHttp {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<void>> spaceReserve({
|
||||
required Object sid,
|
||||
required bool isFollow,
|
||||
}) async {
|
||||
final res = await Request().post(
|
||||
isFollow ? Api.spaceReserveCancel : Api.spaceReserve,
|
||||
data: {
|
||||
'sid': sid,
|
||||
'csrf': Accounts.main.csrf,
|
||||
},
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return const Success(null);
|
||||
} else {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user