add CORS to api/join

This commit is contained in:
Cedric Hutchings 2022-02-24 12:14:04 -05:00
parent d68912050e
commit effe3c5626
3 changed files with 20 additions and 5 deletions

View file

@ -7,13 +7,12 @@ const joinTable = new AirtablePlus({
})
export default async function handler(req, res) {
let open = process.env.NEXT_PUBLIC_OPEN == "true" ? true : false
if (req.method === 'OPTIONS') {
return res
.status(204)
.json({ status: 'YIPPE YAY. YOU HAVE CLEARANCE TO PROCEED.' })
.status(200)
.send('YIPPE YAY. YOU HAVE CLEARANCE TO PROCEED.');
}
if (req.method === 'GET') {
return res

View file

@ -1,3 +1,19 @@
{
"github": { "silent": true }
"github": { "silent": true },
"headers": [
{
"source": "/api/join",
"headers": [
{ "key": "Access-Control-Allow-Origin", "value": "*" },
{
"key": "Access-Control-Allow-Methods",
"value": "GET,OPTIONS,PATCH,DELETE,POST,PUT"
},
{
"key": "Access-Control-Allow-Headers",
"value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version"
}
]
}
]
}

View file

@ -265,7 +265,7 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"
"@emotion/babel-plugin@^11.3.0", "@emotion/babel-plugin@^11.7.1":
"@emotion/babel-plugin@^11.7.1":
version "11.7.2"
resolved "https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.7.2.tgz#fec75f38a6ab5b304b0601c74e2a5e77c95e5fa0"
integrity sha512-6mGSCWi9UzXut/ZAN6lGFu33wGR3SJisNl3c0tvlmb8XChH1b2SUvxvnOh7hvLpqyRdHHU9AiazV3Cwbk5SXKQ==