From 240f4401f455241f3e7de59fc48a2059e9b3d818 Mon Sep 17 00:00:00 2001 From: Gamebrary Date: Tue, 1 Sep 2020 10:43:48 -0700 Subject: [PATCH] update boards store when renaming board --- src/components/Settings/BoardSettings.vue | 4 ++++ src/store/mutations.js | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/components/Settings/BoardSettings.vue b/src/components/Settings/BoardSettings.vue index 8521231d..4d14cd59 100644 --- a/src/components/Settings/BoardSettings.vue +++ b/src/components/Settings/BoardSettings.vue @@ -253,6 +253,10 @@ export default { this.$store.commit('SET_BOARD', payload); + if (board.name !== this.name) { + this.$store.commit('UPDATE_BOARD_NAME', payload); + } + await this.$store.dispatch('SAVE_BOARD') .catch(() => { this.saving = false; diff --git a/src/store/mutations.js b/src/store/mutations.js index 8a13c0ee..872cca5a 100755 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -18,6 +18,12 @@ export default { state.board = board; }, + UPDATE_BOARD_NAME(state, updatedBoard) { + const board = state.boards.find(({ id }) => updatedBoard.id === id); + + board.name = updatedBoard.name; + }, + SET_GAME_BOARD(state, board) { state.board = board; },