Attempt to fix CORS

This commit is contained in:
Max Wofford 2020-06-18 13:14:17 +00:00
parent db04ddb1ee
commit 8c1fdb3f62
2 changed files with 7 additions and 1 deletions

View file

@ -7,6 +7,9 @@ const joinTable = new AirtablePlus({
})
export default async (req, res) => {
if (req.method == 'OPTIONS') {
return res.status(204).json({ status: "YIPPE YAY. YOU HAVE CLEARANCE TO PROCEED." })
}
if (req.method == 'GET') {
return res.status(405).json({ error: '*GET outta here!* (Method not allowed, use POST)' })
}

View file

@ -6,7 +6,10 @@
"headers": [
{
"source": "/api/(.+)",
"headers": [{ "key": "Access-Control-Allow-Origin", "value": "*" }]
"headers": [
{ "key": "Access-Control-Allow-Origin", "value": "*" },
{ "key": "Access-Control-Allow-Methods", "value": "POST, OPTIONS" }
]
}
]
}