Skip to content

Commit

Permalink
use dynamic env
Browse files Browse the repository at this point in the history
  • Loading branch information
jonerrr committed Aug 18, 2024
1 parent 5e18a0a commit a3ac13d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -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]);

Expand Down
4 changes: 2 additions & 2 deletions src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -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]);

Expand Down

0 comments on commit a3ac13d

Please sign in to comment.