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 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-02-17 13:41:12 +01:00
parent 497b12c561
commit 03d90f2bda

View file

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