yo-next-auth/data/verification-token.ts

18 lines
478 B
TypeScript

import db from '@/lib/db'
import { VerificationToken } from '@prisma/client'
export const getVerificationTokenByToken = async (token: string) => {
try {
return await db.verificationToken.findUnique({ where: { token } })
} catch {
return null
}
}
export const getVerificationTokenByEmail = async (email: string): Promise<VerificationToken | null> => {
try {
return await db.verificationToken.findFirst({ where: { email } })
} catch {
return null
}
}