Remove NGINX website directories from API and fix some minor issues

This commit is contained in:
thiloho
2024-10-17 16:53:31 +02:00
parent 1b74e1e6fb
commit 185aeea4e5
20 changed files with 166 additions and 126 deletions

View File

@@ -4,37 +4,24 @@ import { apiRequest } from "$lib/server/utils";
import type { Settings, Header, Footer } from "$lib/db-schema";
export const load: PageServerLoad = async ({ params, fetch }) => {
const globalSettings: Settings = (
await apiRequest(
fetch,
`${API_BASE_PREFIX}/settings?website_id=eq.${params.websiteId}`,
"GET",
{
headers: {
Accept: "application/vnd.pgrst.object+json"
},
returnData: true
}
)
).data;
const header: Header = (
await apiRequest(fetch, `${API_BASE_PREFIX}/header?website_id=eq.${params.websiteId}`, "GET", {
headers: {
Accept: "application/vnd.pgrst.object+json"
},
const [globalSettingsResponse, headerResponse, footerResponse] = await Promise.all([
apiRequest(fetch, `${API_BASE_PREFIX}/settings?website_id=eq.${params.websiteId}`, "GET", {
headers: { Accept: "application/vnd.pgrst.object+json" },
returnData: true
}),
apiRequest(fetch, `${API_BASE_PREFIX}/header?website_id=eq.${params.websiteId}`, "GET", {
headers: { Accept: "application/vnd.pgrst.object+json" },
returnData: true
}),
apiRequest(fetch, `${API_BASE_PREFIX}/footer?website_id=eq.${params.websiteId}`, "GET", {
headers: { Accept: "application/vnd.pgrst.object+json" },
returnData: true
})
).data;
]);
const footer: Footer = (
await apiRequest(fetch, `${API_BASE_PREFIX}/footer?website_id=eq.${params.websiteId}`, "GET", {
headers: {
Accept: "application/vnd.pgrst.object+json"
},
returnData: true
})
).data;
const globalSettings: Settings = globalSettingsResponse.data;
const header: Header = headerResponse.data;
const footer: Footer = footerResponse.data;
return {
globalSettings,