diff --git a/.gitignore b/.gitignore index 74b7586..07ce2c3 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ yarn-error.log* # vercel .vercel + +trash \ No newline at end of file diff --git a/src/components/sections/contact/form/index.tsx b/src/components/sections/contact/form/index.tsx index 61d440e..9783e5e 100644 --- a/src/components/sections/contact/form/index.tsx +++ b/src/components/sections/contact/form/index.tsx @@ -59,7 +59,7 @@ const CustomForm = ({ data }: FormProps) => { inquiry: selectedOption.value } - await fetch('/api/contact', { + await fetch(`${process.env.NEXT_PUBLIC_API}/api/contact`, { method: 'POST', mode: 'no-cors', body: JSON.stringify(data), diff --git a/src/components/sections/partners/contact/index.tsx b/src/components/sections/partners/contact/index.tsx index 322bbbe..ad37a50 100644 --- a/src/components/sections/partners/contact/index.tsx +++ b/src/components/sections/partners/contact/index.tsx @@ -78,7 +78,7 @@ const CustomForm = ({ data }: FormProps) => { role: role } - await fetch('/api/inquiry', { + await fetch(`${process.env.NEXT_PUBLIC_API}/api/inquiry`, { method: 'POST', mode: 'no-cors', body: JSON.stringify(data), diff --git a/src/lib/notion/index.ts b/src/lib/notion/index.ts deleted file mode 100644 index 0a5a6a4..0000000 --- a/src/lib/notion/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Client } from '@notionhq/client' - -export const notion = new Client({ - auth: process.env.NOTION_TOKEN -}) - -export const notionAlt = new Client({ - auth: process.env.NOTION_TOKEN_ALT -}) diff --git a/src/pages/api/contact.ts b/src/pages/api/contact.ts deleted file mode 100644 index 0d68295..0000000 --- a/src/pages/api/contact.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { NextApiRequest, NextApiResponse } from 'next' - -import { internalServerError, success } from '../../lib/api-responses' -import { notion } from '../../lib/notion' - -export default async (req: NextApiRequest, res: NextApiResponse) => { - try { - const { email, message, inquiry } = JSON.parse(req.body) - await notion.pages.create({ - parent: { - database_id: '03c225f0469d436db60bd1b225deffef' as string - }, - properties: { - Email: { - email, - type: 'email' - }, - Message: { - type: 'rich_text', - rich_text: [{ text: { content: message }, type: 'text' }] - }, - 'Type of inquiry': { - type: 'select', - select: { name: inquiry } - } - } - }) - - success(res) - } catch (error) { - internalServerError(res, error) - } -} diff --git a/src/pages/api/inquiry.ts b/src/pages/api/inquiry.ts deleted file mode 100644 index 4f3ebc2..0000000 --- a/src/pages/api/inquiry.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { NextApiRequest, NextApiResponse } from 'next' - -import { internalServerError, success } from '../../lib/api-responses' -import { notionAlt } from '../../lib/notion' - -export default async (req: NextApiRequest, res: NextApiResponse) => { - try { - const { name, email, message, inquiry, role, company, jurisdiction } = - JSON.parse(req.body) - await notionAlt.pages.create({ - parent: { - database_id: '90a7d71e342f4b91b7ca263a14d839ea' as string - }, - properties: { - Name: { - title: [ - { - text: { - content: name - } - } - ] - }, - Email: { - email, - type: 'email' - }, - Message: { - type: 'rich_text', - rich_text: [{ text: { content: message }, type: 'text' }] - }, - Role: { - type: 'rich_text', - rich_text: [{ text: { content: role }, type: 'text' }] - }, - Company: { - type: 'rich_text', - rich_text: [{ text: { content: company }, type: 'text' }] - }, - 'Legal jurisdiction': { - type: 'rich_text', - rich_text: [{ text: { content: jurisdiction }, type: 'text' }] - }, - Inquiry: { - type: 'select', - select: { name: inquiry } - } - } - }) - - success(res) - } catch (error) { - internalServerError(res, error) - } -}