diff --git a/frontend/src/components/mapMenu/MapMenu.tsx b/frontend/src/components/mapMenu/MapMenu.tsx index 29878eb..44daec1 100644 --- a/frontend/src/components/mapMenu/MapMenu.tsx +++ b/frontend/src/components/mapMenu/MapMenu.tsx @@ -21,12 +21,10 @@ const MapMenu: React.FC = observer(() => { mapMenuStore.fetchModules().then(() => { mapMenuStore.fetchModuleById(mapMenuStore.availableModules[0].id).then(() => { mapMenuStore.fetchLevels().then(() => { - console.log(mapMenuStore.availableLevels[0]) + console.log(mapMenuStore.availableLevels) }) }) }) - // mapMenuStore.setModulesMap(mapMenuStore.mapMenu!.modules_ids) - // mapMenuStore.fetchModuleById(mapMenuStore?.modulesMap[0]).then() }) }) }, [navigate]) diff --git a/frontend/src/store/mapMenuStore.ts b/frontend/src/store/mapMenuStore.ts index 5dd2ffd..d6c58a1 100644 --- a/frontend/src/store/mapMenuStore.ts +++ b/frontend/src/store/mapMenuStore.ts @@ -66,7 +66,8 @@ class MapMenuStore { } async fetchModules() { - await axios.get("http://localhost:8000/maps/" + this.currentMapId + "/modules/").then((response) => this.setAvailableModules(response.data)) + await axios.get("http://localhost:8000/maps/" + this.currentMapId + "/modules/") + .then((response) => this.setAvailableModules(response.data)) } async createModule(mapId: string, title: string, previousModuleId: string, nextModuleId: string, moduleId: string, levels_ids: string[]) { @@ -88,9 +89,8 @@ class MapMenuStore { } async fetchLevels() { - await axios.get("http://localhost:8000/maps/" + this.currentMapId + "/modules/" + this.currentModuleId + "/levels/").then((response) => { - this.setAvailableLevels(response.data) - }) + await axios.get("http://localhost:8000/maps/" + this.currentMapId + "/modules/" + this.currentModuleId + "/levels/") + .then((response) => this.setAvailableLevels(response.data)) } async fetchLevelById(id: string) {