diff --git a/src/features/liveEvents/context.tsx b/src/features/liveEvents/context.tsx index 3de2534a8..e11955f57 100644 --- a/src/features/liveEvents/context.tsx +++ b/src/features/liveEvents/context.tsx @@ -24,6 +24,7 @@ export const DEFAULT_LIVE_EVENTS = { async function fetchLiveEvents(): Promise { try { + if (!LIVE_EVENTS_URL) return null const res = await fetch(`${LIVE_EVENTS_URL}/config`) if (!res.ok) return null const data = await res.json() diff --git a/src/geolocation/const.ts b/src/geolocation/const.ts index 653e829ba..4992cc870 100644 --- a/src/geolocation/const.ts +++ b/src/geolocation/const.ts @@ -1,7 +1,9 @@ import {GEOLOCATION_URL} from '#/env' import {type Geolocation} from '#/geolocation/types' -export const GEOLOCATION_SERVICE_URL = `${GEOLOCATION_URL}/geolocation` +export const GEOLOCATION_SERVICE_URL = GEOLOCATION_URL + ? `${GEOLOCATION_URL}/geolocation` + : null /** * Default geolocation config. diff --git a/src/geolocation/service.ts b/src/geolocation/service.ts index 2d9285b67..c7c3d02c0 100644 --- a/src/geolocation/service.ts +++ b/src/geolocation/service.ts @@ -26,9 +26,10 @@ const onGeolocationServiceResponseUpdate = ( } async function fetchGeolocationServiceData( - url: string, + url: string | null, ): Promise { if (debug.enabled) return debug.resolve(debug.geolocation) + if (!url) throw new Error('geolocation service disabled') const res = await fetch(url) if (!res.ok) { throw new Error(`fetchGeolocationServiceData failed ${res.status}`) diff --git a/src/state/appConfig.tsx b/src/state/appConfig.tsx index 67b0e553e..9eacf7ead 100644 --- a/src/state/appConfig.tsx +++ b/src/state/appConfig.tsx @@ -30,6 +30,7 @@ let fetchAppConfigPromise: Promise | undefined async function fetchAppConfig(): Promise { try { + if (!APP_CONFIG_URL) return null if (!fetchAppConfigPromise) { fetchAppConfigPromise = (async () => { const r = await fetch(`${APP_CONFIG_URL}/config`)