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