mirror of
https://github.com/romancm/gamebrary
synced 2024-11-15 15:57:59 +00:00
combine SET_ACTIVE_BOARD and UPDATE_BOARDS mutations
This commit is contained in:
parent
1c9f84da27
commit
d11035788a
4 changed files with 7 additions and 11 deletions
|
@ -166,7 +166,6 @@ export default {
|
|||
};
|
||||
|
||||
this.$store.commit('SET_ACTIVE_BOARD', payload);
|
||||
this.$store.commit('UPDATE_BOARDS', payload);
|
||||
|
||||
await this.$store.dispatch('SAVE_BOARD')
|
||||
.catch(() => {
|
||||
|
|
|
@ -219,7 +219,6 @@ export default {
|
|||
};
|
||||
|
||||
this.$store.commit('SET_ACTIVE_BOARD', payload);
|
||||
this.$store.commit('UPDATE_BOARDS', payload);
|
||||
|
||||
await this.$store.dispatch('SAVE_BOARD')
|
||||
.catch(() => {
|
||||
|
|
|
@ -174,7 +174,6 @@ export default {
|
|||
};
|
||||
|
||||
this.$store.commit('SET_ACTIVE_BOARD', payload);
|
||||
this.$store.commit('UPDATE_BOARDS', payload);
|
||||
|
||||
await this.$store.dispatch('SAVE_BOARD')
|
||||
.catch(() => {
|
||||
|
|
|
@ -28,20 +28,19 @@ export default {
|
|||
|
||||
SET_ACTIVE_BOARD(state, board) {
|
||||
state.board = board;
|
||||
|
||||
// Update board in boards
|
||||
const boardIndex = state.boards.findIndex(({ id }) => board.id === id);
|
||||
|
||||
if (boardIndex) {
|
||||
Vue.set(state.boards, boardIndex, board);
|
||||
}
|
||||
},
|
||||
|
||||
SET_PUBLIC_BOARDS(state, publicBoards) {
|
||||
state.publicBoards = publicBoards;
|
||||
},
|
||||
|
||||
UPDATE_BOARDS(state, updatedBoard) {
|
||||
const boardIndex = state.boards.findIndex(({ id }) => updatedBoard.id === id);
|
||||
|
||||
if (!boardIndex) return;
|
||||
|
||||
Vue.set(state.boards, boardIndex, updatedBoard);
|
||||
},
|
||||
|
||||
SET_GAME_BOARD(state, board) {
|
||||
state.board = board;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue