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

22 lines
589 B
TypeScript

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