N
Nuxt3w ago
Samu

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
})
1 Reply
Samu
Samu2w ago
How to deal with authenticated endpoints ?