mirror of
https://github.com/System-End/site.git
synced 2026-04-20 00:25:19 +00:00
Revert "Reduce time to join Slack (#416)"
This reverts commit 39997a7ea9.
This commit is contained in:
parent
39997a7ea9
commit
4828beffd4
1 changed files with 14 additions and 16 deletions
|
|
@ -7,6 +7,7 @@ const joinTable = new AirtablePlus({
|
|||
})
|
||||
|
||||
async function postData(url = '', data = {}, headers = {}) {
|
||||
console.log(data)
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
|
|
@ -55,21 +56,19 @@ export default async function handler(req, res) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
let promises = []
|
||||
|
||||
promises.push(joinTable.create({
|
||||
|
||||
await joinTable.create({
|
||||
'Full Name': data.name,
|
||||
'Email Address': data.email,
|
||||
Student: data.educationLevel != 'tertiary' ? true : false,
|
||||
Reason: data.reason,
|
||||
Invited: open,
|
||||
Club: data.club ? data.club : '',
|
||||
IP: req.headers['x-forwarded-for'] || req.socket.remoteAddress
|
||||
}))
|
||||
|
||||
'Email Address': data.email,
|
||||
Student: data.educationLevel != 'tertiary' ? true : false,
|
||||
Reason: data.reason,
|
||||
Invited: open,
|
||||
Club: data.club ? data.club : '',
|
||||
IP: req.headers['x-forwarded-for'] || req.socket.remoteAddress
|
||||
})
|
||||
|
||||
if (open) {
|
||||
promises.push(postData(
|
||||
let result = await postData(
|
||||
'https://toriel.hackclub.com/slack-invite',
|
||||
{
|
||||
email: data.email,
|
||||
|
|
@ -81,11 +80,10 @@ export default async function handler(req, res) {
|
|||
userAgent: req.headers['user-agent'],
|
||||
},
|
||||
{ authorization: `Bearer ${process.env.TORIEL_KEY}` }
|
||||
))
|
||||
await Promise.all(promises)
|
||||
)
|
||||
console.log(result)
|
||||
res.json({ status: 'success', message: 'You’ve been invited to Slack!' })
|
||||
} else {
|
||||
await Promise.all(promises)
|
||||
res.json({
|
||||
status: 'success',
|
||||
message: 'Your request will be reviewed soon.'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue