yo-next-auth/data/verification-token.ts
2024-04-26 22:16:21 +03:00

32 lines
803 B
TypeScript

'use server'
import db from '@/lib/db'
import journal from '@/actions/logger'
export const getVerificationTokenByToken = async (token: string) => {
try {
return await db.verificationToken.findUnique({ where: { token } })
} catch (err) {
journal.error({ getVerificationTokenByToken: err, token })
return null
}
}
export const getVerificationTokenByEmail = async (email: string) => {
try {
return await db.verificationToken.findFirst({ where: { email } })
} catch (err) {
journal.error({ getVerificationTokenByEmail: err, email })
return null
}
}
export const deleteVerificationToken = async (id: string) => {
try {
await db.verificationToken.delete({
where: { id },
})
} catch (err) {
journal.error({ deleteVerificationToken: err, id })
}
}