pronounscc/frontend/src/routes/+layout.server.ts

21 lines
523 B
TypeScript
Raw Normal View History

import { error } from "@sveltejs/kit";
import type { LayoutServerLoad } from "./$types";
import type { APIError } from "$lib/api/entities";
import { apiFetch } from "$lib/api/fetch";
export const load = (async (event) => {
try {
return await apiFetch<MetaResponse>("/meta", {});
} catch (e) {
throw error(500, (e as APIError).message);
}
}) satisfies LayoutServerLoad;
interface MetaResponse {
git_repository: string;
git_commit: string;
users: number;
members: number;
2023-03-14 00:16:19 +01:00
require_invite: boolean;
}