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() {