import { getServerSession, getToken } from '#auth'

export default eventHandler(async (event) => {
  const session = await getServerSession(event)
  if (!session) {
    event.context.auth = false
  }
  else {
    const token = await getToken({ event })
    event.context.auth = { token }
  }
})
