Skip to content

Commit 6e84022

Browse files
committed
Fix 404 errors on geojson data
1 parent b4ca844 commit 6e84022

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/components/Map.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,17 @@ export default function GrunkartMap() {
214214
const [parkOnly, setParkOnly] = useState(false);
215215

216216
useEffect(() => {
217+
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? '';
217218
const files = [
218-
{ path: '/data/boundary.geojson', key: 'boundary' },
219-
{ path: '/data/green-areas.geojson', key: 'greenAreas' },
220-
{ path: '/data/water.geojson', key: 'water' },
221-
{ path: '/data/baumkataster.geojson', key: 'trees' },
222-
{ path: '/data/paths.geojson', key: 'paths' },
223-
{ path: '/data/benches.geojson', key: 'benches' },
224-
{ path: '/data/playgrounds.geojson', key: 'playgrounds' },
225-
{ path: '/data/playground-equipment.geojson', key: 'playgroundEquipment' },
226-
{ path: '/data/squares.geojson', key: 'squares' },
219+
{ path: `${basePath}/data/boundary.geojson`, key: 'boundary' },
220+
{ path: `${basePath}/data/green-areas.geojson`, key: 'greenAreas' },
221+
{ path: `${basePath}/data/water.geojson`, key: 'water' },
222+
{ path: `${basePath}/data/baumkataster.geojson`, key: 'trees' },
223+
{ path: `${basePath}/data/paths.geojson`, key: 'paths' },
224+
{ path: `${basePath}/data/benches.geojson`, key: 'benches' },
225+
{ path: `${basePath}/data/playgrounds.geojson`, key: 'playgrounds' },
226+
{ path: `${basePath}/data/playground-equipment.geojson`, key: 'playgroundEquipment' },
227+
{ path: `${basePath}/data/squares.geojson`, key: 'squares' },
227228
];
228229

229230
Promise.allSettled(files.map((f) => fetchGeoJSON(f.path))).then((results) => {

0 commit comments

Comments
 (0)