2022-11-10 00:12:34 +05:30
|
|
|
import type { PageServerLoad } from "./$types";
|
2022-11-29 21:12:15 +05:30
|
|
|
import { compile } from "mdsvex";
|
2022-12-06 20:30:23 +05:30
|
|
|
import { env } from "$env/dynamic/private";
|
2022-11-10 00:12:34 +05:30
|
|
|
|
|
|
|
export const load: PageServerLoad = async () => {
|
2022-12-27 20:58:47 +05:30
|
|
|
return {
|
|
|
|
state: await fetch(
|
|
|
|
env.VITE_API_URL + "/api/v1/state/announcements"
|
|
|
|
).then((res) => res.json()).catch(() => ({})),
|
|
|
|
announcements: await fetch(
|
|
|
|
env.VITE_API_URL + "/api/v1/announcements"
|
|
|
|
).then((res) => res.json()).catch(() => ({})),
|
|
|
|
content: await fetch(env.VITE_API_URL + "/api/v1/announcements")
|
|
|
|
.then((res) => res.json())
|
|
|
|
.then((res) => compile(res.title))
|
|
|
|
.then((res) => res?.code).catch(() => ({})),
|
|
|
|
};
|
|
|
|
};
|