-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from dddwa/app-proxy-links
Add in session proxy links for the app
- Loading branch information
Showing
6 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { HeadersFunction, json, LoaderFunctionArgs } from '@remix-run/node' | ||
import { TypeOf } from 'zod' | ||
import { conferenceConfig } from '~/config/conference-config' | ||
import { getYearConfig } from '~/lib/get-year-config' | ||
import { CACHE_CONTROL } from '~/lib/http.server' | ||
import { getScheduleGrid, gridSmartSchema } from '~/lib/sessionize.server' | ||
|
||
export async function loader({ context }: LoaderFunctionArgs) { | ||
const { yearConfig } = getYearConfig(context.conferenceState.conference.year, context.conferenceState.conference) | ||
|
||
if (yearConfig.sessions?.kind === 'sessionize' && !yearConfig.sessions.sessionizeEndpoint) { | ||
throw new Response(JSON.stringify({ message: 'No sessionize endpoint for year' }), { status: 404 }) | ||
} | ||
|
||
const schedules: TypeOf<typeof gridSmartSchema> = | ||
yearConfig.sessions?.kind === 'sessionize' | ||
? await getScheduleGrid({ | ||
sessionizeEndpoint: yearConfig.sessions.sessionizeEndpoint, | ||
confTimeZone: conferenceConfig.timezone, | ||
}) | ||
: // TODO Deal with data type | ||
[] | ||
|
||
const schedule = schedules[0] | ||
|
||
return json(schedule, { headers: { 'Cache-Control': CACHE_CONTROL.conf } }) | ||
} | ||
export const headers: HeadersFunction = ({ loaderHeaders }) => { | ||
// Inherit the caching headers from the loader so we don't cache 404s | ||
return loaderHeaders | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { HeadersFunction, json, LoaderFunctionArgs } from '@remix-run/node' | ||
import { TypeOf } from 'zod' | ||
import { conferenceConfig } from '~/config/conference-config' | ||
import { getYearConfig } from '~/lib/get-year-config' | ||
import { CACHE_CONTROL } from '~/lib/http.server' | ||
import { getConfSessions, sessionsSchema } from '~/lib/sessionize.server' | ||
|
||
export async function loader({ context }: LoaderFunctionArgs) { | ||
const { yearConfig } = getYearConfig(context.conferenceState.conference.year, context.conferenceState.conference) | ||
|
||
if (yearConfig.sessions?.kind === 'sessionize' && !yearConfig.sessions.sessionizeEndpoint) { | ||
throw new Response(JSON.stringify({ message: 'No sessionize endpoint for year' }), { status: 404 }) | ||
} | ||
|
||
const sessions: TypeOf<typeof sessionsSchema> = | ||
yearConfig.sessions?.kind === 'sessionize' | ||
? await getConfSessions({ | ||
sessionizeEndpoint: yearConfig.sessions.sessionizeEndpoint, | ||
confTimeZone: conferenceConfig.timezone, | ||
}) | ||
: [] | ||
|
||
return json(sessions, { headers: { 'Cache-Control': CACHE_CONTROL.conf } }) | ||
} | ||
|
||
export const headers: HeadersFunction = ({ loaderHeaders }) => { | ||
// Inherit the caching headers from the loader so we don't cache 404s | ||
return loaderHeaders | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { HeadersFunction, json, LoaderFunctionArgs } from '@remix-run/node' | ||
import { TypeOf } from 'zod' | ||
import { conferenceConfig } from '~/config/conference-config' | ||
import { getYearConfig } from '~/lib/get-year-config' | ||
import { CACHE_CONTROL } from '~/lib/http.server' | ||
import { getConfSpeakers, speakersSchema } from '~/lib/sessionize.server' | ||
|
||
export async function loader({ context }: LoaderFunctionArgs) { | ||
const { yearConfig } = getYearConfig(context.conferenceState.conference.year, context.conferenceState.conference) | ||
|
||
if (yearConfig.sessions?.kind === 'sessionize' && !yearConfig.sessions.sessionizeEndpoint) { | ||
throw new Response(JSON.stringify({ message: 'No sessionize endpoint for year' }), { status: 404 }) | ||
} | ||
|
||
const speakers: TypeOf<typeof speakersSchema> = | ||
yearConfig.sessions?.kind === 'sessionize' | ||
? await getConfSpeakers({ | ||
sessionizeEndpoint: yearConfig.sessions.sessionizeEndpoint, | ||
confTimeZone: conferenceConfig.timezone, | ||
}) | ||
: [] | ||
|
||
return json(speakers, { headers: { 'Cache-Control': CACHE_CONTROL.conf } }) | ||
} | ||
|
||
export const headers: HeadersFunction = ({ loaderHeaders }) => { | ||
// Inherit the caching headers from the loader so we don't cache 404s | ||
return loaderHeaders | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters