| 251 | }, |
| 252 | |
| 253 | async fetchSessionsCountForDate ({ commit, getters }, { date }) { |
| 254 | const exists = getters.getSessionsCountForDate(date) |
| 255 | if (exists) { |
| 256 | return exists |
| 257 | } |
| 258 | try { |
| 259 | const sessions = await levelSessionsApi.fetchCompletedByDate(date) |
| 260 | commit('setSessionsCountForDate', { date, sessions }) |
| 261 | return sessions |
| 262 | } catch (e) { |
| 263 | console.error('Error in fetching sessions count for date', e) |
| 264 | noty({ text: 'Error in fetching sessions count for date', type: 'error', timeout: 1000 }) |
| 265 | } |
| 266 | }, |
| 267 | |
| 268 | async fetchLevelSessionsForCampaignOfRelatedUser ({ commit, state, getters }, { userId, campaignHandle, options = {} }) { |
| 269 | commit('initSessionsByCampaignState', campaignHandle) |