Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix: 修复圈子帖子删除和置顶的api丢失的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jul 2, 2018
1 parent fb70894 commit d8a6118
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/api/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,32 @@ export function getGroudFeedsByType(
);
}

/**
* 申请帖子置顶
* @author mutoe <[email protected]>
* @export
* @param {Number} postId
* @param {Object} params
* @returns {Promise}
*/
export function applyTopPost(postId, params) {
const url = `/plus-group/currency-pinned/posts/${postId}`;
return api.post(url, params, { validateStatus: s => s === 201 });
}

/**
* 删除帖子
* @author mutoe <[email protected]>
* @export
* @param {Number} groupId
* @param {Number} postId
* @returns {Promise}
*/
export function deletePost(groupId, postId) {
const url = `/plus-group/groups/${groupId}/posts/${postId}`;
return api.delete(url, { validateStatus: s => s === 204 });
}

export function likeGroupPost(postID, status) {
const url = `/plus-group/group-posts/${postID}/likes`;
const method = status ? "delete" : "post";
Expand Down
2 changes: 1 addition & 1 deletion src/page/group/GroupPostDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export default {
text: "删除",
style: { color: "#f4504d" },
method: () => {
deletePost(this.postID).then(() => {
deletePost(this.groupID, this.postID).then(() => {
this.$Message.success("删除帖子成功");
this.goBack();
});
Expand Down

0 comments on commit d8a6118

Please sign in to comment.