website/src/routes/+page.server.ts

12 lines
549 B
TypeScript
Raw Normal View History

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-11-10 00:12:34 +05:30
export const load: PageServerLoad = async () => {
return {
state: await fetch("https://api.projectsegfau.lt/api/v1/state/announcements").then((res) => res.json()),
2022-11-29 21:12:15 +05:30
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)
2022-11-10 00:12:34 +05:30
}
2022-11-29 21:12:15 +05:30
}