From a3ac13dccd7aca4c9dcf6da9b4a8e66ff5ee49d3 Mon Sep 17 00:00:00 2001 From: Jonah <73760377+jonerrr@users.noreply.github.com> Date: Sun, 18 Aug 2024 11:31:46 -0400 Subject: [PATCH] use dynamic env --- src/routes/+layout.ts | 8 +++++--- src/routes/+page.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index df25679..c14706c 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1,9 +1,11 @@ -import { PUBLIC_API_URL } from '$env/static/public'; +import { env } from '$env/dynamic/public'; import type { LayoutLoad } from './$types'; export const load: LayoutLoad = async ({ fetch }) => { - const routes_promise = fetch(`${PUBLIC_API_URL}/bus/routes/geojson`).then((res) => res.json()); - const stops_promise = fetch(`${PUBLIC_API_URL}/bus/stops/geojson`).then((res) => res.json()); + const routes_promise = fetch(`${env.PUBLIC_API_URL}/bus/routes/geojson`).then((res) => + res.json() + ); + const stops_promise = fetch(`${env.PUBLIC_API_URL}/bus/stops/geojson`).then((res) => res.json()); const [routes, stops] = await Promise.all([routes_promise, stops_promise]); diff --git a/src/routes/+page.ts b/src/routes/+page.ts index 467f9ea..d4264d1 100644 --- a/src/routes/+page.ts +++ b/src/routes/+page.ts @@ -1,8 +1,8 @@ -import { PUBLIC_API_URL } from '$env/static/public'; +import { env } from '$env/dynamic/public'; import type { PageLoad } from './$types'; export const load: PageLoad = async ({ fetch }) => { - const trips_promise = fetch(`${PUBLIC_API_URL}/bus/trips/geojson`).then((res) => res.json()); + const trips_promise = fetch(`${env.PUBLIC_API_URL}/bus/trips/geojson`).then((res) => res.json()); const [trips] = await Promise.all([trips_promise]);