Implement edit board name

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
Michael Weimann
2019-01-06 23:06:35 +01:00
parent c8b5b1efa5
commit 47b08f0e52
2 changed files with 56 additions and 7 deletions

View File

@@ -82,6 +82,13 @@ export default new Vuex.Store({
}
},
mutations: {
/**
* Adds or replaces a board in the store.
* Matches a board by it's id.
*
* @param state
* @param board
*/
addBoard(state, board) {
const indexExisting = state.boards.findIndex((b) => {
return board.id === b.id
@@ -137,6 +144,17 @@ export default new Vuex.Store({
commit('addBoard', board)
})
},
/**
* Updates a board API side.
*
* @param commit
* @param board The board to update.
* @return {Promise<void>}
*/
async updateBoard({ commit }, board) {
const storedBoard = await apiClient.updateBoard(board)
commit('addBoard', storedBoard)
},
createBoard({ commit }, boardData) {
apiClient.createBoard(boardData)
.then((board) => {