mirror of
https://github.com/ProjectSegfault/website.git
synced 2024-12-25 22:50:18 +05:30
get api url from env
This commit is contained in:
parent
e2b9b84457
commit
d63d141e8c
1
.env.example
Normal file
1
.env.example
Normal file
@ -0,0 +1 @@
|
|||||||
|
VITE_API_URL=https://api.projectsegfau.lt
|
@ -3,9 +3,9 @@ import { compile } from "mdsvex";
|
|||||||
|
|
||||||
export const load: PageServerLoad = async () => {
|
export const load: PageServerLoad = async () => {
|
||||||
return {
|
return {
|
||||||
state: await fetch("https://api.projectsegfau.lt/api/v1/state/announcements").then((res) => res.json()),
|
state: await fetch(import.meta.env.VITE_API_URL + "/api/v1/state/announcements").then((res) => res.json()),
|
||||||
announcements: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()),
|
announcements: await fetch(import.meta.env.VITE_API_URL + "/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)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,6 @@ import type { PageServerLoad } from "../$types";
|
|||||||
|
|
||||||
export const load: PageServerLoad = async () => {
|
export const load: PageServerLoad = async () => {
|
||||||
return {
|
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())
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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="https://api.projectsegfau.lt/api/v1/form"
|
action="{import.meta.env.VITE_API_URL}/api/v1/form"
|
||||||
method="POST"
|
method="POST"
|
||||||
id="contact-form"
|
id="contact-form"
|
||||||
>
|
>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { PageServerLoad } from "./$types";
|
import type { PageServerLoad } from "./$types";
|
||||||
|
|
||||||
export const load: PageServerLoad = async () => {
|
export const load: PageServerLoad = async () => {
|
||||||
return await fetch("https://api.projectsegfau.lt/api/v1/status").then((res) => res.json());
|
return await fetch(import.meta.env.VITE_API_URL + "/api/v1/status").then((res) => res.json());
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user