fix build
This commit is contained in:
parent
20cc339948
commit
568c6bdcb9
2 changed files with 12 additions and 30 deletions
|
|
@ -1,19 +1,21 @@
|
|||
import { NextResponse } from "next/server"
|
||||
import { ReactElement } from "react"
|
||||
import { Resend } from "resend"
|
||||
import { EmailTemplate } from "../../../components/Email/EmailTemplate"
|
||||
import { CreateEmailOptions } from "resend/build/src/emails/interfaces"
|
||||
import { EmailTemplate, EmailTemplateProps } from "../../../components/Email/EmailTemplate"
|
||||
|
||||
const resend = new Resend(process.env.RESEND_API_KEY)
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const res = await request.json()
|
||||
const payload = {
|
||||
subject: "Contact Form Submission",
|
||||
from: "onboarding@resend.dev",
|
||||
react: EmailTemplate(res as Readonly<EmailTemplateProps>) as ReactElement,
|
||||
to: "sam.antonis@isacon.be",
|
||||
} as CreateEmailOptions
|
||||
try {
|
||||
const data = await resend.emails.send({
|
||||
subject: res.subject,
|
||||
from: "onboarding@resend.dev",
|
||||
react: EmailTemplate(res),
|
||||
to: "sam.antonis@isacon.be",
|
||||
})
|
||||
|
||||
const data = await resend.emails.send(payload)
|
||||
return NextResponse.json(data)
|
||||
} catch (error) {
|
||||
return NextResponse.json({ error })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue