fix: add to watchlist

This commit is contained in:
Simon Ding
2024-07-12 14:36:32 +08:00
parent fc35850426
commit 55966b8115
5 changed files with 40 additions and 10 deletions

View File

@@ -28,10 +28,14 @@ class SearchPageData extends AutoDisposeAsyncNotifier<List<SearchResult>> {
return list;
}
Future<void> submit2Watchlist(int id) async {
Future<void> submit2Watchlist(int tmdbId, int storageId, String resolution) async {
final dio = await APIs.getDio();
var resp = await dio
.post(APIs.watchlistUrl, data: {"id": id, "folder": "/downloads"});
.post(APIs.watchlistUrl, data: {
"tmdb_id": tmdbId,
"storage_id": storageId,
"resolution": resolution
});
var sp = ServerResponse.fromJson(resp.data);
if (sp.code != 0) {
throw sp.message;