Use SvelteKit render function for templating and add error page

This commit is contained in:
thiloho
2024-08-17 19:29:10 +02:00
parent e41b963666
commit f3278fb1f6
11 changed files with 141 additions and 154 deletions

View File

@@ -1,5 +1,6 @@
import type { LayoutServerLoad } from "./$types";
import { API_BASE_PREFIX } from "$lib/utils";
import { error } from "@sveltejs/kit";
export const load: LayoutServerLoad = async ({ params, fetch, cookies }) => {
const websiteData = await fetch(`${API_BASE_PREFIX}/website?id=eq.${params.websiteId}`, {
@@ -11,6 +12,10 @@ export const load: LayoutServerLoad = async ({ params, fetch, cookies }) => {
}
});
if (!websiteData.ok) {
throw error(404, "Website not found");
}
const homeData = await fetch(`${API_BASE_PREFIX}/home?website_id=eq.${params.websiteId}`, {
method: "GET",
headers: {