Skip to content

Commit

Permalink
fix: cache hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
qin-guan committed Jul 16, 2023
1 parent f35b7f1 commit 5f69a17
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ export default defineNuxtConfig({
image: {},
nitro: {
storage: {
devStorage: {
driver: 'memory',
},
redis: (() => (process.env.NUXT_ENABLE_REDIS
? {
driver: 'redis',
Expand All @@ -62,6 +59,11 @@ export default defineNuxtConfig({
}
))(),
},
devStorage: {
redis: {
driver: 'memory',
},
},
},

runtimeConfig: {
Expand Down
2 changes: 1 addition & 1 deletion pages/thanks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async function create() {
if (err.data.code === 'BAD_REQUEST') {
toast.add({
severity: 'error',
summary: 'Please enter a valid NRIC or phone number!',
summary: 'Please enter a valid NRIC and phone number!',
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions server/trpc/routers/me/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { z } from 'zod'
import { createStorage, prefixStorage } from 'unstorage'
import { prefixStorage } from 'unstorage'
import type { User } from '@prisma/client'
import { protectedProcedure, router } from '../../trpc'

const baseStorage = createStorage()
const baseStorage = useStorage('redis')
const userStorage = prefixStorage(baseStorage, 'users')

export const meRouter = router({
Expand Down
4 changes: 2 additions & 2 deletions server/trpc/routers/survey/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import type { Survey } from '@prisma/client'
import { Prisma } from '@prisma/client'
import { TRPCError } from '@trpc/server'
import { z } from 'zod'
import { createStorage, prefixStorage } from 'unstorage'
import { prefixStorage } from 'unstorage'
import type { QuestionsSchema, SurveyPermissionSchema } from '../../../../shared/survey'
import { questionsSchema, surveyPermissionSchema } from '../../../../shared/survey'
import { protectedProcedure, router } from '../../trpc'

const baseStorage = createStorage()
const baseStorage = useStorage('redis')
const surveyStorage = prefixStorage(baseStorage, 'surveys')

export const surveyRouter = router({
Expand Down

0 comments on commit 5f69a17

Please sign in to comment.