update boards store when renaming board

This commit is contained in:
Gamebrary 2020-09-01 10:43:48 -07:00
parent 2a82ca3a26
commit 240f4401f4
2 changed files with 10 additions and 0 deletions

View file

@ -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;

View file

@ -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;
},