From 21e412a60b08c80d2510565ba1c663c6164eba96 Mon Sep 17 00:00:00 2001 From: Jake Ginnivan Date: Tue, 22 Oct 2024 10:50:24 +0800 Subject: [PATCH] Add cors headers to the app config route --- website/app/routes/app-config.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/website/app/routes/app-config.tsx b/website/app/routes/app-config.tsx index 11fcb60..6017f01 100644 --- a/website/app/routes/app-config.tsx +++ b/website/app/routes/app-config.tsx @@ -1,9 +1,9 @@ -import { LoaderFunctionArgs } from '@remix-run/server-runtime' +import { json, LoaderFunctionArgs } from '@remix-run/server-runtime' import { YearSponsors } from '~/lib/config-types' /** This route is used by the app or integrations to understand the state of the conference */ -export function loader({ context }: LoaderFunctionArgs): AppConfig { - return { +export function loader({ context }: LoaderFunctionArgs) { + const data: AppConfig = { conferenceDate: context.conferenceState.conference.date ?? null, sponsors: context.conferenceState.conference.sponsors, support: 'https://raw.githubusercontent.com/dddwa/dddperth/refs/heads/main/website-content/pages/support.mdx', @@ -11,6 +11,12 @@ export function loader({ context }: LoaderFunctionArgs): AppConfig { after: 'https://raw.githubusercontent.com/dddwa/dddperth/refs/heads/main/website-content/pages/post-conference.mdx', }, } + + return json(data, { + headers: { + 'Access-Control-Allow-Origin': '*', + }, + }) } interface AppConfig {