fix strapi urls and shit
All checks were successful
Deployment / Deploy website (push) Successful in 2m32s
Deployment / Deploy strapi (push) Successful in 3m5s

This commit is contained in:
Benjamin Palko 2025-05-06 12:31:44 -04:00
parent 0e94cb95ca
commit 0eb91d67dd
8 changed files with 92 additions and 66 deletions

View file

@ -1,20 +1,31 @@
import { env } from '$env/dynamic/private';
import type { Handle, HandleServerError } from '@sveltejs/kit';
import { randomUUID } from 'crypto';
import { env } from "$env/dynamic/private";
import { Strapi } from "$lib/server/strapi";
import type { Handle, HandleServerError } from "@sveltejs/kit";
import { randomUUID } from "crypto";
export const handleError: HandleServerError = async ({ error, event, message, status }) => {
export const handleError: HandleServerError = async ({
error,
event,
message,
status,
}) => {
const errorId = randomUUID();
console.error(error, { errorId, event, message, status });
return {
message: 'An Internal Error Occurred',
errorId
message: "An Internal Error Occurred",
errorId,
};
};
export const handle: Handle = async ({ event, resolve }) => {
event.locals.Strapi.url = `http://${env.STRAPI_HOST}:${env.STRAPI_PORT}`;
event.locals = {
strapi: new Strapi(
`http://${env.STRAPI_HOST}:${env.STRAPI_PORT}`,
env.STRAPI_TOKEN,
),
};
const response = await resolve(event);
return response;