Add add board functionality

This commit is contained in:
Michael Weimann
2018-12-16 22:47:58 +01:00
parent 6a3643384c
commit 22744ee39c
3 changed files with 42 additions and 1 deletions

View File

@@ -32,6 +32,29 @@ export class BoardApi {
return OC.generateUrl(url)
}
/**
* Creates a new board.
*
* @param {{String title, String color}} boardData The board data with title and color in hex format, e.g. "#ff0000"
* @return Promise
*/
createBoard(boardData) {
boardData.color = boardData.color.substr(1)
return axios.post(this.url('/boards'), boardData)
.then(
(response) => {
return Promise.resolve(response.data)
},
(err) => {
return Promise.reject(err)
}
)
.catch((err) => {
return Promise.reject(err)
})
}
loadBoards() {
return axios.get(this.url('/boards'))
.then(