Skip to content
Snippets Groups Projects
Commit 17b638d2 authored by xaralis's avatar xaralis
Browse files

fix: likes highlighting

parent ae3cc166
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,10 @@ export const like = createAsyncAction( ...@@ -64,7 +64,10 @@ export const like = createAsyncAction(
postActionHook: ({ result }) => { postActionHook: ({ result }) => {
if (!result.error) { if (!result.error) {
PostStore.update((state) => { PostStore.update((state) => {
state.items[result.payload.id].ranking.myVote = "like"; state.items[result.payload.id].ranking.myVote =
state.items[result.payload.id].ranking.myVote !== "like"
? "like"
: "none";
}); });
} }
}, },
...@@ -90,7 +93,10 @@ export const dislike = createAsyncAction( ...@@ -90,7 +93,10 @@ export const dislike = createAsyncAction(
postActionHook: ({ result }) => { postActionHook: ({ result }) => {
if (!result.error) { if (!result.error) {
PostStore.update((state) => { PostStore.update((state) => {
state.items[result.payload.id].ranking.myVote = "dislike"; state.items[result.payload.id].ranking.myVote =
state.items[result.payload.id].ranking.myVote !== "dislike"
? "dislike"
: "none";
}); });
} }
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment