mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: null safety
This commit is contained in:
@@ -352,9 +352,7 @@ class VideoHttp {
|
|||||||
|
|
||||||
// (取消)点赞
|
// (取消)点赞
|
||||||
static Future likeVideo({required String bvid, required bool type}) async {
|
static Future likeVideo({required String bvid, required bool type}) async {
|
||||||
var res = await Request().post(
|
var res = await Request().post(Api.likeVideo, queryParameters: {
|
||||||
Api.likeVideo,
|
|
||||||
queryParameters: {
|
|
||||||
'aid': IdUtils.bv2av(bvid),
|
'aid': IdUtils.bv2av(bvid),
|
||||||
'like': type ? 0 : 1,
|
'like': type ? 0 : 1,
|
||||||
'access_key': GStorage.localCache
|
'access_key': GStorage.localCache
|
||||||
@@ -594,9 +592,17 @@ class VideoHttp {
|
|||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
});
|
});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': res.data['result']['toast']};
|
return {
|
||||||
|
'status': true,
|
||||||
|
'msg':
|
||||||
|
res.data['result'] == null ? 'failed' : res.data['result']['toast']
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'msg': res.data['result']['toast']};
|
return {
|
||||||
|
'status': false,
|
||||||
|
'msg':
|
||||||
|
res.data['result'] == null ? 'failed' : res.data['result']['toast']
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,9 +613,17 @@ class VideoHttp {
|
|||||||
'csrf': await Request.getCsrf(),
|
'csrf': await Request.getCsrf(),
|
||||||
});
|
});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'msg': res.data['result']['toast']};
|
return {
|
||||||
|
'status': true,
|
||||||
|
'msg':
|
||||||
|
res.data['result'] == null ? 'failed' : res.data['result']['toast']
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'msg': res.data['result']['toast']};
|
return {
|
||||||
|
'status': false,
|
||||||
|
'msg':
|
||||||
|
res.data['result'] == null ? 'failed' : res.data['result']['toast']
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user