mirror of
https://github.com/System-End/site.git
synced 2026-04-19 23:22:49 +00:00
20 lines
556 B
JavaScript
20 lines
556 B
JavaScript
export default async function submit(req, res) {
|
|
if (req.method === 'POST') {
|
|
const data = req.body
|
|
|
|
const resp = await fetch('https://postal.hackclub.com/subscribe', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
body: new URLSearchParams({
|
|
api_key: process.env.POSTAL_API_KEY,
|
|
name: data.name,
|
|
email: data.email,
|
|
list: process.env.POSTAL_LIST_ID,
|
|
boolean: 'true'
|
|
}).toString()
|
|
}).then(r => r.text())
|
|
res.json(resp)
|
|
}
|
|
}
|