mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
* Changed some things w/ CTA and Blueprint Branding Moved BP CTA as the other programs are only in RSVP * I oblidge
36 lines
788 B
JavaScript
36 lines
788 B
JavaScript
export async function getConsoles() {
|
|
try {
|
|
const response = await fetch(
|
|
'https://airbridge.hackclub.com/v0.1/Sprig%20Waitlist/Requests'
|
|
)
|
|
|
|
if (!response.ok) {
|
|
return 100
|
|
}
|
|
|
|
const data = await response.json()
|
|
|
|
function check(val) {
|
|
return val === 'Pending' || val === 'Approved'
|
|
}
|
|
|
|
const consoleCount = Array.isArray(data)
|
|
? data.filter(console => check(console.fields.Status)).length
|
|
: 100
|
|
|
|
return consoleCount
|
|
} catch (error) {
|
|
console.error('Error fetching console data:', error)
|
|
return 100
|
|
}
|
|
}
|
|
|
|
export default async function SprigConsoles(req, res) {
|
|
let consoleCount = 100
|
|
try {
|
|
consoleCount = await getConsoles()
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
res.json(consoleCount)
|
|
}
|