From 6072f7f674bc3def903815de35536ed933cff7fd Mon Sep 17 00:00:00 2001 From: whoswhip Date: Fri, 9 Jan 2026 20:33:18 -0500 Subject: [PATCH] fix: update API fetch calls to use dynamic apiUrl --- SharpbinV3.Client/src/routes/[id]/+page.server.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SharpbinV3.Client/src/routes/[id]/+page.server.ts b/SharpbinV3.Client/src/routes/[id]/+page.server.ts index 4240f9f..0835c96 100644 --- a/SharpbinV3.Client/src/routes/[id]/+page.server.ts +++ b/SharpbinV3.Client/src/routes/[id]/+page.server.ts @@ -3,10 +3,12 @@ import type { Paste } from '$lib/types/paste'; import { getServerToken } from '$lib/utils/auth'; import { env } from '$env/dynamic/private'; +const apiUrl = process.env.VITE_API_URL || 'http://localhost:5050'; + export const load: PageServerLoad = async ({ params, fetch, url, cookies }) => { const { id } = params; - const paste = await fetch(`/api/paste/${id}`); + const paste = await fetch(`${apiUrl}/api/paste/${id}`); if (paste.status === 404) { return { status: 404, @@ -17,7 +19,7 @@ export const load: PageServerLoad = async ({ params, fetch, url, cookies }) => { const token = getServerToken(cookies); const apiKey = env.VIEW_INTERNAL_API_KEY ?? env.View_HMAC_Internal_API_Key ?? ''; - const viewed = await fetch(`/api/paste/${id}/view`, { + const viewed = await fetch(`${apiUrl}/api/paste/${id}/view`, { method: 'POST', headers: { 'X-Internal-API-Key': apiKey,