Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/danielroe/roe.dev. This is the code and content for my personal website, built in Nuxt. roe.dev
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940import type { H3Event } from 'h3'
interface SessionData { authenticated: boolean sponsor?: boolean avatar?: string name?: string}
export function getUserSession (event: H3Event) { const config = useRuntimeConfig(event) return getSession<SessionData>(event, { password: config.sessionPassword, name: 'token', cookie: { httpOnly: false }, })}
export function setUserSession (event: H3Event, data: any) { const config = useRuntimeConfig(event) return updateSession<SessionData>( event, { password: config.sessionPassword, name: 'token', cookie: { httpOnly: false }, }, data, )}
export function clearUserSession (event: H3Event) { const config = useRuntimeConfig(event) return clearSession(event, { password: config.sessionPassword, name: 'token', cookie: { httpOnly: false }, })}