Skip to content

Commit

Permalink
fix: wrong cache store used
Browse files Browse the repository at this point in the history
  • Loading branch information
qin-guan committed Jul 19, 2023
1 parent 4f6be18 commit 399d490
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/trpc/routers/response/response.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const responseRouter = router({
.meta({ participants: true })
.query(async ({ ctx }) => {
let data
if (await ctx.cache.users.hasItem(`${ctx.session.user.id}-submitted`)) {
data = await ctx.cache.users.getItem<UserIncludeSurvey>(`${ctx.session.user.id}-submitted`)
if (await ctx.cache.surveys.hasItem(`${ctx.session.user.id}-submitted`)) {
data = await ctx.cache.surveys.getItem<UserIncludeSurvey>(`${ctx.session.user.id}-submitted`)
if (!data)
throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR' })
}
Expand All @@ -46,7 +46,7 @@ export const responseRouter = router({
},
},
})
await ctx.cache.users.setItem(`${ctx.session.user.id}-submitted`, data)
await ctx.cache.surveys.setItem(`${ctx.session.user.id}-submitted`, data)
}

return data.surveyResponses
Expand Down

0 comments on commit 399d490

Please sign in to comment.