N
Nuxt6mo 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
SamuOP5mo ago
How to deal with authenticated endpoints ?
Want results from more Discord servers?
Add your server