Samu
Samu
NNuxt
Created by Samu on 6/21/2024 in #❓・help
How to cache this (authenticated) ?
I am using NuxtHub. I mean this : const { user } = await requireUserSession(event) give me problems.
import type { H3Event } from 'h3'

export default cachedEventHandler((event) => {
const { user } = await requireUserSession(event) // from nuxt-auth-utils

// call to db with user.id
// ...
}, {
maxAge: 60 * 60, // 1 hour
})
import type { H3Event } from 'h3'

export default cachedEventHandler((event) => {
const { user } = await requireUserSession(event) // from nuxt-auth-utils

// call to db with user.id
// ...
}, {
maxAge: 60 * 60, // 1 hour
})
2 replies