Skip to content

Commit

Permalink
bugfix:修复收藏BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbbbbbbbbbbba committed Jun 3, 2024
1 parent dd1e855 commit 3bff534
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions site/src/pages/topic/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ async function like() {
async function addFavorite(topicId) {
try {
if (this.topic.favorited) {
if (topic.value.favorited) {
await useHttpPostForm("/api/favorite/delete", {
body: {
entityType: "topic",
entityId: topicId,
},
});
this.topic.favorited = false;
topic.value.favorited = false;
useMsgSuccess("已取消收藏");
} else {
await useHttpPostForm("/api/favorite/add", {
Expand All @@ -283,7 +283,7 @@ async function addFavorite(topicId) {
entityId: topicId,
},
});
this.topic.favorited = true;
topic.value.favorited = true;
useMsgSuccess("收藏成功");
}
} catch (e) {
Expand Down

0 comments on commit 3bff534

Please sign in to comment.