diff --git a/.gitignore b/.gitignore index 69c3f3f..dc61a8d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ node_modules /build /.svelte-kit /package -#.env -#.env.* -#!.env.example +.env +.env.* +!.env.example package-lock.json \ No newline at end of file diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 7549f2b..ec1236b 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -1,11 +1,12 @@ import type { PageServerLoad } from "./$types"; import { compile } from "mdsvex"; +import { env } from "$env/dynamic/private"; export const load: PageServerLoad = async () => { return { - state: await fetch(import.meta.env.VITE_API_URL + "/api/v1/state/announcements").then((res) => res.json()), - announcements: await fetch(import.meta.env.VITE_API_URL + "/api/v1/announcements").then((res) => res.json()), - content: await fetch(import.meta.env.VITE_API_URL + "/api/v1/announcements").then((res) => res.json()).then((res) => compile(res.title)).then((res) => res.code) + state: await fetch(env.VITE_API_URL + "/api/v1/state/announcements").then((res) => res.json()), + announcements: await fetch(env.VITE_API_URL + "/api/v1/announcements").then((res) => res.json()), + content: await fetch(env.VITE_API_URL + "/api/v1/announcements").then((res) => res.json()).then((res) => compile(res.title)).then((res) => res.code) } } diff --git a/src/routes/contact/+page.server.ts b/src/routes/contact/+page.server.ts index d1bf91b..0b36674 100644 --- a/src/routes/contact/+page.server.ts +++ b/src/routes/contact/+page.server.ts @@ -1,7 +1,9 @@ import type { PageServerLoad } from "../$types"; +import { env } from "$env/dynamic/private"; export const load: PageServerLoad = async () => { return { - state: await fetch(import.meta.env.VITE_API_URL + "/api/v1/state/form").then((res) => res.json()) + state: await fetch(env.VITE_API_URL + "/api/v1/state/form").then((res) => res.json()), + apiUrl: env.VITE_API_URL } } \ No newline at end of file diff --git a/src/routes/contact/+page.svelte b/src/routes/contact/+page.svelte index 43581b0..a1d9d14 100644 --- a/src/routes/contact/+page.svelte +++ b/src/routes/contact/+page.svelte @@ -21,7 +21,7 @@