Updated config and OPTIONS method for function.

This commit is contained in:
Michael Mainguy 2023-11-07 15:28:26 -06:00
parent 57a5d03518
commit a2fc7ec460

View File

@ -191,15 +191,16 @@ export default async (req: Request): Promise<Response> => {
if (authorizeUserResponse.status != 200) {
throw new Error('could not authorize user');
}
const origin = req.headers['origin'];
const origin = req.headers.get('origin');
console.log(origin);
return new Response(
'OK',
{
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': origin ? origin : 'https://cameras.immersiveidea.com',
'Access-Control-Allow-Credentials': 'true'
},
headers: [
['Content-Type', 'application/json'],
['Access-Control-Allow-Origin', origin],
['Access-Control-Allow-Credentials', 'true']
],
status: 200
}
)