From 529e93caff6d89a1825fc50524ec8bcb4aab1734 Mon Sep 17 00:00:00 2001 From: hpkoh Date: Sun, 9 Oct 2022 11:04:04 +0800 Subject: [PATCH] [questions][chore] update var name --- apps/portal/src/server/router/questions-question-router.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/portal/src/server/router/questions-question-router.ts b/apps/portal/src/server/router/questions-question-router.ts index c91f3ac7..5d82dbea 100644 --- a/apps/portal/src/server/router/questions-question-router.ts +++ b/apps/portal/src/server/router/questions-question-router.ts @@ -135,13 +135,13 @@ export const questionsQuestionsRouter = createProtectedRouter() async resolve({ ctx, input }) { const userId = ctx.session?.user?.id; - const questionToUpdate = await ctx.prisma.questionsQuestion.findUnique({ + const questionToDelete = await ctx.prisma.questionsQuestion.findUnique({ where: { id: input.id, }, }); - if (questionToUpdate?.id !== userId) { + if (questionToDelete?.id !== userId) { throw new TRPCError({ code: 'UNAUTHORIZED', message: 'User have no authorization to record.',