mirror of
https://github.com/System-End/site.git
synced 2026-04-19 16:28:21 +00:00
changes
This commit is contained in:
parent
562440f726
commit
dfa384dc16
2 changed files with 18 additions and 2 deletions
|
|
@ -13,9 +13,22 @@ import { useRouter } from 'next/router'
|
|||
import useForm from '../../lib/use-form'
|
||||
import Submit from '../submit'
|
||||
import { getCookie, hasCookie } from 'cookies-next'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
const JoinForm = ({ sx = {} }) => {
|
||||
const router = useRouter()
|
||||
const [event, setEvent] = useState(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!router.isReady) {
|
||||
setEvent(null)
|
||||
console.log('not ready yet!')
|
||||
} else {
|
||||
setEvent(router.query.event)
|
||||
console.log('Hello from the client!', name)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const { status, formProps, useField } = useForm('/api/join/', null, {
|
||||
clearOnSubmit: 5000,
|
||||
method: 'POST',
|
||||
|
|
@ -23,7 +36,7 @@ const JoinForm = ({ sx = {} }) => {
|
|||
? {
|
||||
continent: getCookie('continent'),
|
||||
reason: router.query.reason,
|
||||
event: router.query.event
|
||||
event: event
|
||||
}
|
||||
: { reason: router.query.reason, event: router.query.event }
|
||||
})
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ export default async function handler(req, res) {
|
|||
})
|
||||
}
|
||||
|
||||
console.log("Hello from the server!", data.event)
|
||||
console.log("Hello from the server!", data)
|
||||
|
||||
const airtablePromise = joinTable.create({
|
||||
'Full Name': data.name,
|
||||
'Email Address': data.email,
|
||||
|
|
@ -62,7 +65,7 @@ export default async function handler(req, res) {
|
|||
Reason: data.reason,
|
||||
Invited: !waitlist,
|
||||
Club: data.club ? data.club : '',
|
||||
Event: data.event ? data.event : '',
|
||||
'Event': data.event ? data.event : '',
|
||||
IP: req.headers['x-forwarded-for'] || req.socket.remoteAddress
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue