Files
penx/lib/getSession.ts
2024-11-11 10:21:54 +08:00

24 lines
618 B
TypeScript

import { User, UserRole } from '@prisma/client'
import NextAuth, { getServerSession, type NextAuthOptions } from 'next-auth'
import { authOptions } from './auth'
import { SubscriptionInSession } from './types'
export async function getSession() {
return getServerSession(authOptions) as Promise<{
// return getServerSession() as Promise<{
user: {
id: string
name: string
username: string
email: string
image: string
}
userId: string
address: string
chainId: string
ensName: string
role: UserRole
subscriptions: SubscriptionInSession[]
} | null>
}