diff --git a/src/resolvers/Mutation.js b/src/resolvers/Mutation.js index ad52b84..05184b3 100644 --- a/src/resolvers/Mutation.js +++ b/src/resolvers/Mutation.js @@ -44,11 +44,11 @@ async function login(parent, args, context, info) { async function vote(parent, args, context, info) { const userId = getUserId(context) - const linkExists = await context.prisma.$exists.vote({ + const voteExists = await context.prisma.$exists.vote({ user: { id: userId }, link: { id: args.linkId }, }) - if (linkExists) { + if (voteExists) { throw new Error(`Already voted for link: ${args.linkId}`) }