MCPcopy Create free account
hub / github.com/codecombat/codecombat / fetchData

Function fetchData

app/core/store/modules/teacherDashboard.js:301–313  ·  view source on GitHub ↗
({ state, dispatch, commit }, { componentName, options = {} })

Source from the content-addressed store, hash-verified

299 // options = { data: {} }
300 // options.data = {} -> contains specific properties to fetch (or `project`) for an object as a string, eg: {users: 'firstName,lastName,email', levelSessions: 'state.complete,level,creator,changed'}
301 async fetchData ({ state, dispatch, commit }, { componentName, options = {} }) {
302 if (!state.teacherId) {
303 console.error('Error in fetching data: teacherId is not set')
304 noty({ text: 'Error in fetching data', type: 'error', layout: 'center', timeout: 2000 })
305 return
306 }
307
308 commit('startLoading')
309 commit('setComponentName', componentName)
310 const fetchPromises = []
311 fetchPromises.push(fetchDataByComponent({ dispatch, state, commit }, { componentName, options }))
312 await Promise.all(fetchPromises)
313 },
314
315 // My classes page
316 // options.data = { levelSessions: '' } -> properties needed for these objects, i.e. will be used as `project` in db queries

Callers

nothing calls this directly

Calls 2

fetchDataByComponentFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected