Fix competitive mode db integration

This commit is contained in:
2022-10-29 15:36:38 +02:00
parent 61884f7679
commit 2f4291207c
2 changed files with 59 additions and 14 deletions

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)
}
}