mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
Retest api route
This commit is contained in:
parent
785771a598
commit
e7a1261b6a
2 changed files with 25 additions and 2 deletions
|
|
@ -41,11 +41,11 @@ const JoinForm = () => {
|
|||
}}
|
||||
>
|
||||
<form
|
||||
action="https://hooks.zapier.com/hooks/catch/507705/o5lw2on/"
|
||||
action="/api/join"
|
||||
method="post"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault()
|
||||
fetch('https://hooks.zapier.com/hooks/catch/507705/o5lw2on/', {
|
||||
fetch('/api/join', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ name, email, teen, reason })
|
||||
})
|
||||
|
|
|
|||
23
pages/api/join.js
Normal file
23
pages/api/join.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const AirtablePlus = require('airtable-plus')
|
||||
|
||||
const joinTable = new AirtablePlus({
|
||||
apiKey: 'keysWpSXVV7AGLLAg',
|
||||
baseID: 'appaqcJtn33vb59Au',
|
||||
tableName: 'Join Requests'
|
||||
})
|
||||
|
||||
export default async (req, res) => {
|
||||
if (req.method === 'POST') {
|
||||
console.log('hi')
|
||||
const data = JSON.parse(req.body)
|
||||
console.log(data)
|
||||
console.log(data.name)
|
||||
await joinTable.create({
|
||||
'Full Name': data.name,
|
||||
'Email Address': data.email,
|
||||
'Student': data.hs ? true : false,
|
||||
'Reason': data.reason
|
||||
})
|
||||
res.json({ status: 'success' })
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue