Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {get} from '@frogpond/ccc-lib'

export async function theEventsCalendar(calendarUrl) {
let resp = await get(calendarUrl, {json: true})
return resp.body
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "@frogpond/ccc-the-events-calendar",
"version": "1.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {googleCalendar} from '@frogpond/ccc-google-calendar'
import {reasonCalendar} from '@frogpond/ccc-reason-calendar'
import {theEventsCalendar} from '@frogpond/ccc-the-events-calendar'
import {ONE_MINUTE} from '@frogpond/ccc-lib'
import mem from 'mem'

export const getGoogleCalendar = mem(googleCalendar, {maxAge: ONE_MINUTE})
export const getReasonCalendar = mem(reasonCalendar, {maxAge: ONE_MINUTE})
export const getTheEventsCalendar = mem(theEventsCalendar, {maxAge: ONE_MINUTE})

export async function google(ctx) {
ctx.cacheControl(ONE_MINUTE)
Expand All @@ -31,6 +33,13 @@ export async function stolaf(ctx) {
ctx.body = await getGoogleCalendar(id)
}

export async function eventsCalendar(ctx) {
ctx.cacheControl(ONE_MINUTE)

let calendarUrl = 'https://wp.stolaf.edu/calendar/wp-json/tribe/events/v1/events'
ctx.body = await getTheEventsCalendar(calendarUrl)
}

export async function oleville(ctx) {
ctx.cacheControl(ONE_MINUTE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ api.get('/calendar/google', calendar.google)
api.get('/calendar/reason', calendar.reason)
api.get('/calendar/ics', calendar.ics)
api.get('/calendar/named/stolaf', calendar.stolaf)
api.get('/calendar/named/stolaf-the-events-calendar', calendar.eventsCalendar)
Comment thread
drewvolz marked this conversation as resolved.
Outdated
api.get('/calendar/named/oleville', calendar.oleville)
api.get('/calendar/named/northfield', calendar.northfield)
api.get('/calendar/named/krlx-schedule', calendar.krlx)
Expand Down