Skip to content

Commit

Permalink
добавляет получение уровней, но пока что почему-то с ошибками
Browse files Browse the repository at this point in the history
  • Loading branch information
semant1cs committed Nov 20, 2023
1 parent 44ae65f commit d6e703b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions frontend/src/components/mapMenu/MapMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/store/mapMenuStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) {
Expand All @@ -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) {
Expand Down

0 comments on commit d6e703b

Please sign in to comment.