mirror of
https://github.com/ProjectSegfault/website.git
synced 2024-11-17 21:53:06 +05:30
fix env vars
This commit is contained in:
parent
17b3c9c666
commit
6c46524ab3
6
.gitignore
vendored
6
.gitignore
vendored
@ -3,7 +3,7 @@ node_modules
|
|||||||
/build
|
/build
|
||||||
/.svelte-kit
|
/.svelte-kit
|
||||||
/package
|
/package
|
||||||
#.env
|
.env
|
||||||
#.env.*
|
.env.*
|
||||||
#!.env.example
|
!.env.example
|
||||||
package-lock.json
|
package-lock.json
|
@ -1,11 +1,12 @@
|
|||||||
import type { PageServerLoad } from "./$types";
|
import type { PageServerLoad } from "./$types";
|
||||||
import { compile } from "mdsvex";
|
import { compile } from "mdsvex";
|
||||||
|
import { env } from "$env/dynamic/private";
|
||||||
|
|
||||||
export const load: PageServerLoad = async () => {
|
export const load: PageServerLoad = async () => {
|
||||||
return {
|
return {
|
||||||
state: await fetch(import.meta.env.VITE_API_URL + "/api/v1/state/announcements").then((res) => res.json()),
|
state: await fetch(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()),
|
announcements: await fetch(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)
|
content: await fetch(env.VITE_API_URL + "/api/v1/announcements").then((res) => res.json()).then((res) => compile(res.title)).then((res) => res.code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import type { PageServerLoad } from "../$types";
|
import type { PageServerLoad } from "../$types";
|
||||||
|
import { env } from "$env/dynamic/private";
|
||||||
|
|
||||||
export const load: PageServerLoad = async () => {
|
export const load: PageServerLoad = async () => {
|
||||||
return {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,7 +21,7 @@
|
|||||||
<h2>Contact form</h2>
|
<h2>Contact form</h2>
|
||||||
{#if data.state.enabled === true}
|
{#if data.state.enabled === true}
|
||||||
<Form
|
<Form
|
||||||
action="{import.meta.env.VITE_API_URL}/api/v1/form"
|
action="{data.apiUrl}/api/v1/form"
|
||||||
method="POST"
|
method="POST"
|
||||||
id="contact-form"
|
id="contact-form"
|
||||||
>
|
>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import type { PageServerLoad } from "./$types";
|
import type { PageServerLoad } from "./$types";
|
||||||
|
import { env } from "$env/dynamic/private";
|
||||||
|
|
||||||
export const load: PageServerLoad = async () => {
|
export const load: PageServerLoad = async () => {
|
||||||
return await fetch(import.meta.env.VITE_API_URL + "/api/v1/status").then((res) => res.json());
|
return await fetch(env.VITE_API_URL + "/api/v1/status").then((res) => res.json());
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user