diff --git a/src/pages/api/services/proxy.js b/src/pages/api/services/proxy.js index 595a94545..b77c5dd55 100644 --- a/src/pages/api/services/proxy.js +++ b/src/pages/api/services/proxy.js @@ -3,12 +3,17 @@ import createLogger from "utils/logger"; import genericProxyHandler from "utils/proxy/handlers/generic"; import widgets from "widgets/widgets"; import calendarProxyHandler from "widgets/calendar/proxy"; +import getServiceWidget from "utils/config/service-helpers"; const logger = createLogger("servicesProxy"); export default async function handler(req, res) { try { - const { type } = req.query; + const { service, group } = req.query; + const serviceWidget = await getServiceWidget(group, service); + let type = serviceWidget?.type; + // calendar is an alias for ical + if (type === "calendar") type = "ical"; const widget = widgets[type]; if (!widget) { diff --git a/src/utils/proxy/api-helpers.js b/src/utils/proxy/api-helpers.js index dceea3c4f..8e0682dbc 100644 --- a/src/utils/proxy/api-helpers.js +++ b/src/utils/proxy/api-helpers.js @@ -10,7 +10,6 @@ export function formatApiCall(url, args) { export function getURLSearchParams(widget, endpoint) { const params = new URLSearchParams({ - type: widget.type, group: widget.service_group, service: widget.service_name, });