Skip to content

Commit

Permalink
made sure that the gare-de-l-est.geojson does not trigger cors
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Aug 3, 2024
1 parent 467f940 commit b94892c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
12 changes: 9 additions & 3 deletions webclient/app/components/IndoorMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { webglSupport } from "~/composables/webglSupport";
import type { MaplibreMapWithIndoor, IndoorMapOptions } from "maplibre-gl-indoor";
import type { components } from "~/api_types";
import { indoorLayers } from "~/composables/indoorLayer";
import type { FeatureCollection } from "geojson";
const props = defineProps<{ data: DetailsResponse }>();
const map = ref<MaplibreMapWithIndoor | undefined>(undefined);
Expand Down Expand Up @@ -174,9 +175,14 @@ async function initMap(containerId: string) {
addIndoorTo(map);
// Retrieve the geojson from the path and add the map
const geojson = await (
await fetch("https://github.com/map-gl-indoor/map-gl-indoor/raw/main/examples/maps/gare-de-l-est.geojson")
).json();
const req = await fetch(
"https://github.com/map-gl-indoor/map-gl-indoor/raw/main/examples/maps/gare-de-l-est.geojson",
{
credentials: "omit",
mode: "no-cors",
},
);
const geojson: FeatureCollection = await req.json();
const indoorOptions = {
beforeLayerId: "poi_z16",
layers: indoorLayers,
Expand Down
4 changes: 3 additions & 1 deletion webclient/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
"@vueuse/core": "10.11.0",
"@vueuse/nuxt": "10.11.0",
"@vueuse/router": "10.11.0",
"maplibre-gl-indoor": "0.0.6",
"geojson": "0.5.0",
"maplibre-gl": "4.5.1",
"maplibre-gl-indoor": "0.0.6",
"nightwind": "1.1.13",
"nuxt": "3.12.4",
"sharp": "0.33.4",
Expand All @@ -41,6 +42,7 @@
"@nuxt/eslint": "0.4.0",
"@nuxtjs/i18n": "8.3.3",
"@nuxtjs/tailwindcss": "6.12.1",
"@types/geojson": "7946.0.14",
"@types/node": "20.14.14",
"@types/swagger-ui": "3.52.4",
"@vue/tsconfig": "0.5.1",
Expand Down
12 changes: 12 additions & 0 deletions webclient/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b94892c

Please sign in to comment.