Fix competitive mode db integration

This commit is contained in:
Rakantor committed 2022-10-29 15:36:38 +02:00
1 parent 61884f7679
commit 2f4291207c
2 files changed
+59 -14

No files matched your search

+13
View File
@@ -23,6 +23,19 @@ export const mutations = {
},
setSelectedCourse (state, courseID) {
state.selectedCourse = courseID
},
addGameInProgress (state, { courseID, gameID }) {
const index = state.user.gamesStarted.findIndex(e => e.course === courseID)
if (index !== -1) {
state.user.gamesStarted[index].course = courseID
state.user.gamesStarted[index].game = gameID
} else {
state.user.gamesStarted.push({ course: courseID, game: gameID })
}
},
removeGameInProgress (state, courseID) {
const index = state.user.gamesStarted.findIndex(e => e.course === courseID)
state.user.gamesStarted.splice(index, 1)
}
}