MCPcopy Create free account
hub / github.com/dailydotdev/apps / applyPluginVote

Function applyPluginVote

packages/shared/src/hooks/vote/useVotePlugin.ts:15–24  ·  view source on GitHub ↗
(plugin: Plugin, vote: UserVote)

Source from the content-addressed store, hash-verified

13import { useVote } from './useVote';
14
15const applyPluginVote = (plugin: Plugin, vote: UserVote): Plugin => {
16 const wasUpvoted = plugin.userVote === UserVote.Up;
17 const isUpvoted = vote === UserVote.Up;
18
19 return {
20 ...plugin,
21 userVote: vote,
22 upvotes: plugin.upvotes + Number(isUpvoted) - Number(wasUpvoted),
23 };
24};
25
26const updateCachedPlugin = (
27 client: QueryClient,

Callers 1

updateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected