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

Commit

Permalink
fix: 修复圈子帖子收藏失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jul 5, 2018
1 parent cb8734b commit b4aed3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/api/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function collectGroupPost(postId, status) {
*/
export function collectionPost(postId) {
const url = `/plus-group/group-posts/${postId}/collections`;
return api.post(url, { validataStatus: s => s === 204 });
return api.post(url, { validateStatus: s => s === 201 });
}

/**
Expand Down
16 changes: 12 additions & 4 deletions src/page/group/GroupPostDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ export default {
count: this.feed.reward_number
} || {}
);
},
has_collect: {
get() {
return this.feed.collected;
},
set(val) {
this.feed.collected = val;
}
}
},
created() {
Expand Down Expand Up @@ -259,8 +267,8 @@ export default {
defaultActions.push({
text: "取消收藏",
method: () => {
api.collectionPost(this.feedID).then(() => {
this.$Message.success("已加入我的收藏");
api.uncollectPost(this.feedID).then(() => {
this.$Message.success("取消收藏");
this.has_collect = false;
});
}
Expand All @@ -269,8 +277,8 @@ export default {
defaultActions.push({
text: "收藏",
method: () => {
api.uncollectPost(this.feedID).then(() => {
this.$message.success("取消收藏");
api.collectionPost(this.feedID).then(() => {
this.$Message.success("已加入我的收藏");
this.has_collect = true;
});
}
Expand Down

0 comments on commit b4aed3e

Please sign in to comment.