diff --git a/app/.env.dist b/app/.env.dist index 19de2e08..4bfe4320 100644 --- a/app/.env.dist +++ b/app/.env.dist @@ -1,5 +1,5 @@ VITE_OPEN_COLLECTIVE_API_KEY=your_key -VITE_API_URL=http://localhost:8055/ +VITE_API_URL=http://localhost:8055 #VITE_API_URL=https://api.utopia-lab.org/ VITE_MAP_URL=http://local.development #VITE_MAP_URL=CURRENT_WINDOW_LOCATION diff --git a/app/src/App.tsx b/app/src/App.tsx index 34ff2df0..36a3de38 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -142,7 +142,7 @@ function App() { path: '/' + l.name, // url icon: l.markerIcon?.image ? ( Welcome to {map?.name || 'Utopia Map'}

It is a tool for collaborative mapping to connect local initiatives, people and events. diff --git a/app/src/config/index.ts b/app/src/config/index.ts index 98c8b891..28f755d6 100644 --- a/app/src/config/index.ts +++ b/app/src/config/index.ts @@ -1,6 +1,14 @@ +const normalizeBaseUrl = (value: string) => value.replace(/\/+$/, '') + +const getMapUrl = () => { + const url = String(import.meta.env.VITE_MAP_URL ?? 'http://local.development') + if (url === 'CURRENT_WINDOW_LOCATION') return url + return normalizeBaseUrl(url) +} + export const config = { - apiUrl: String(import.meta.env.VITE_API_URL ?? 'http://localhost:8055/'), - mapUrl: String(import.meta.env.VITE_MAP_URL ?? 'http://local.development'), + apiUrl: normalizeBaseUrl(String(import.meta.env.VITE_API_URL ?? 'http://localhost:8055/')), + mapUrl: getMapUrl(), adminRole: String(import.meta.env.VITE_DIRECTUS_ADMIN_ROLE ?? ''), validateInviteFlowId: String( import.meta.env.VITE_VALIDATE_INVITE_FLOW_ID ?? '01d61db0-25aa-4bfa-bc24-c6a8f208a455', diff --git a/app/src/pages/Landingpage.tsx b/app/src/pages/Landingpage.tsx index 9387411c..a5d221fa 100644 --- a/app/src/pages/Landingpage.tsx +++ b/app/src/pages/Landingpage.tsx @@ -138,7 +138,7 @@ export const Landingpage = () => {