diff --git a/src/components/EditorComponent.vue b/src/components/EditorComponent.vue index ffbd3df..e1a1c74 100644 --- a/src/components/EditorComponent.vue +++ b/src/components/EditorComponent.vue @@ -194,7 +194,8 @@ v-if="selected_game" :game="selected_game" @cancel="edit_game = false" - @save-game="updateGame" + @add-game="addGame" + @update-game="updateGame" /> @@ -231,10 +232,18 @@ function editGame(game: BingoGame) { loading.value = false; } -async function updateGame(game: BingoGame) { +async function addGame(game: BingoGame) { loading.value = true; - await localGames.updateGame(game); + await localGames.addGame(game); + + loading.value = false; +} + +async function updateGame(old_game: BingoGame, game: BingoGame) { + loading.value = true; + + await localGames.updateGame(old_game, game); edit_game.value = false; diff --git a/src/composables/GameEditorDialog.vue b/src/composables/GameEditorDialog.vue index 45df176..7f07078 100644 --- a/src/composables/GameEditorDialog.vue +++ b/src/composables/GameEditorDialog.vue @@ -1,153 +1,273 @@