From 03d90f2bda3e20dc7e457dee5392d76c983a4003 Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Tue, 17 Feb 2026 13:41:12 +0100 Subject: [PATCH] fix(lightwrite): add /api/v1 prefix to backend API calls The backend uses a global prefix of /api/v1 but the frontend was calling endpoints without it, causing 404 errors. Co-Authored-By: Claude Opus 4.5 --- .../lightwrite/apps/web/src/lib/stores/project.svelte.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/lightwrite/apps/web/src/lib/stores/project.svelte.ts b/apps/lightwrite/apps/web/src/lib/stores/project.svelte.ts index 0b9f05427..1fa82d8c0 100644 --- a/apps/lightwrite/apps/web/src/lib/stores/project.svelte.ts +++ b/apps/lightwrite/apps/web/src/lib/stores/project.svelte.ts @@ -13,13 +13,14 @@ interface ProjectState { } function getBackendUrl(): string { + let baseUrl = 'http://localhost:3010'; if (typeof window !== 'undefined') { - return ( + baseUrl = (window as unknown as { __PUBLIC_BACKEND_URL__: string }).__PUBLIC_BACKEND_URL__ || - 'http://localhost:3010' - ); + 'http://localhost:3010'; } - return 'http://localhost:3010'; + // Ensure API prefix is included + return baseUrl.endsWith('/api/v1') ? baseUrl : `${baseUrl}/api/v1`; } function createProjectStore() {