diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..5816fa9 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +VITE_API_URL=https://api.projectsegfau.lt \ No newline at end of file diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 28fba08..7549f2b 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -3,9 +3,9 @@ import { compile } from "mdsvex"; export const load: PageServerLoad = async () => { return { - state: await fetch("https://api.projectsegfau.lt/api/v1/state/announcements").then((res) => res.json()), - announcements: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()), - content: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()).then((res) => compile(res.title)).then((res) => res.code) + 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) } } diff --git a/src/routes/contact/+page.server.ts b/src/routes/contact/+page.server.ts index ed76f18..d1bf91b 100644 --- a/src/routes/contact/+page.server.ts +++ b/src/routes/contact/+page.server.ts @@ -2,6 +2,6 @@ import type { PageServerLoad } from "../$types"; export const load: PageServerLoad = async () => { return { - state: await fetch("https://api.projectsegfau.lt/api/v1/state/form").then((res) => res.json()) + state: await fetch(import.meta.env.VITE_API_URL + "/api/v1/state/form").then((res) => res.json()) } } \ No newline at end of file diff --git a/src/routes/contact/+page.svelte b/src/routes/contact/+page.svelte index 796746a..43581b0 100644 --- a/src/routes/contact/+page.svelte +++ b/src/routes/contact/+page.svelte @@ -21,7 +21,7 @@