refactor: posts api

This commit is contained in:
Barış Soner Uşaklı
2020-10-17 22:59:12 -04:00
parent 272e73da53
commit d9a16855d0
9 changed files with 104 additions and 123 deletions

View File

@@ -165,3 +165,22 @@ async function isMainAndLastPost(pid) {
};
}
postsAPI.upvote = async function (caller, data) {
return await apiHelpers.postCommand(caller, 'upvote', 'voted', 'notifications:upvoted_your_post_in', data);
};
postsAPI.downvote = async function (caller, data) {
return await apiHelpers.postCommand(caller, 'downvote', 'voted', '', data);
};
postsAPI.unvote = async function (caller, data) {
return await apiHelpers.postCommand(caller, 'unvote', 'voted', '', data);
};
postsAPI.bookmark = async function (caller, data) {
return await apiHelpers.postCommand(caller, 'bookmark', 'bookmarked', '', data);
};
postsAPI.unbookmark = async function (caller, data) {
return await apiHelpers.postCommand(caller, 'unbookmark', 'bookmarked', '', data);
};