2023-03-15 08:35:16 +01:00
|
|
|
import { sendMagicLinkEmail } from '@typebot.io/emails'
|
2023-03-13 11:20:28 +01:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
identifier: string
|
2023-03-29 08:14:35 +02:00
|
|
|
url: string
|
2023-03-13 11:20:28 +01:00
|
|
|
}
|
|
|
|
|
|
2023-03-29 08:14:35 +02:00
|
|
|
export const sendVerificationRequest = async ({ identifier, url }: Props) => {
|
2023-03-13 11:20:28 +01:00
|
|
|
try {
|
|
|
|
|
await sendMagicLinkEmail({ url, to: identifier })
|
|
|
|
|
} catch (err) {
|
|
|
|
|
throw new Error(`Email(s) could not be sent`)
|
|
|
|
|
}
|
|
|
|
|
}
|