@@ -131,19 +131,18 @@ export default {
|
||||
})
|
||||
|
||||
actions.push({
|
||||
action: async () => {
|
||||
action: async() => {
|
||||
this.hideMenu()
|
||||
this.loading = true
|
||||
try {
|
||||
const newBoard = await this.$store.dispatch('cloneBoard', this.board)
|
||||
|
||||
this.loading = false
|
||||
const route = this.routeTo
|
||||
route.params.id = newBoard.id
|
||||
this.$router.push(route)
|
||||
}
|
||||
catch {
|
||||
} catch (e) {
|
||||
OC.Notification.showTemporary(t('deck', 'An error occurred'))
|
||||
console.error(e)
|
||||
}
|
||||
},
|
||||
icon: 'icon-clone',
|
||||
|
||||
@@ -135,19 +135,13 @@ export class BoardApi {
|
||||
})
|
||||
}
|
||||
|
||||
cloneBoard(board) {
|
||||
return axios.post(this.url(`/boards/${board.id}/clone`))
|
||||
.then(
|
||||
(response) => {
|
||||
return Promise.resolve(response.data)
|
||||
},
|
||||
(err) => {
|
||||
return Promise.reject(err)
|
||||
}
|
||||
)
|
||||
.catch((err) => {
|
||||
return Promise.reject(err)
|
||||
})
|
||||
async cloneBoard(board) {
|
||||
try {
|
||||
let response = await axios.post(this.url(`/boards/${board.id}/clone`))
|
||||
return response.data
|
||||
} catch (err) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Label API Calls
|
||||
|
||||
@@ -280,17 +280,14 @@ export default new Vuex.Store({
|
||||
commit('addBoard', board)
|
||||
})
|
||||
},
|
||||
cloneBoard({ commit }, boardData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
apiClient.cloneBoard(boardData)
|
||||
.then((board) => {
|
||||
commit('cloneBoard', board)
|
||||
resolve(board)
|
||||
})
|
||||
.catch((err) => {
|
||||
return reject(err)
|
||||
})
|
||||
})
|
||||
async cloneBoard({ commit }, boardData) {
|
||||
try {
|
||||
let newBoard = await apiClient.cloneBoard(boardData)
|
||||
commit('cloneBoard', newBoard)
|
||||
return newBoard
|
||||
} catch (err) {
|
||||
return err
|
||||
}
|
||||
},
|
||||
removeBoard({ commit }, board) {
|
||||
commit('removeBoard', board)
|
||||
|
||||
Reference in New Issue
Block a user