mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
31 lines
944 B
JavaScript
31 lines
944 B
JavaScript
export default async function handler(req, res) {
|
|
if (req.method === 'POST') {
|
|
try {
|
|
const { token, email } = req.body
|
|
|
|
const url = new URL('http://takeout.hackclub.com/signup')
|
|
url.searchParams.append('token', token)
|
|
url.searchParams.append('email', email)
|
|
|
|
const response = await fetch(url, { method: 'POST' })
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! status: ${response.status}`)
|
|
}
|
|
|
|
const data = await response.json()
|
|
|
|
// Send the response from the replit-takeout service back to the client
|
|
res.status(200).json(data)
|
|
} catch (error) {
|
|
console.error('Error processing signup:', error)
|
|
res
|
|
.status(500)
|
|
.json({ message: 'Error processing signup', error: error.message })
|
|
}
|
|
} else {
|
|
// Handle any non-POST requests
|
|
res.setHeader('Allow', ['POST'])
|
|
res.status(405).end(`Method ${req.method} Not Allowed`)
|
|
}
|
|
}
|