mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
fixed node liking
This commit is contained in:
parent
d4c2e7ee09
commit
b95d53791c
2 changed files with 6 additions and 3 deletions
|
@ -258,9 +258,9 @@ function* onEditSaga({ id }: ReturnType<typeof nodeEdit>) {
|
|||
}
|
||||
|
||||
function* onLikeSaga({ id }: ReturnType<typeof nodeLike>) {
|
||||
try {
|
||||
const { current }: ReturnType<typeof selectNode> = yield select(selectNode);
|
||||
const { current }: ReturnType<typeof selectNode> = yield select(selectNode);
|
||||
|
||||
try {
|
||||
const count = current.like_count || 0;
|
||||
|
||||
yield call(updateNodeEverywhere, {
|
||||
|
@ -274,6 +274,7 @@ function* onLikeSaga({ id }: ReturnType<typeof nodeLike>) {
|
|||
yield call(updateNodeEverywhere, {
|
||||
...current,
|
||||
is_liked: data.is_liked,
|
||||
like_count: data.is_liked ? count + 1 : Math.max(count - 1, 0),
|
||||
});
|
||||
} catch {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue