Commit 87ca75a3 authored by Simon Knox's avatar Simon Knox

move board delete to Service

parent d5635118
...@@ -15,10 +15,6 @@ const Store = gl.issueBoards.BoardsStore; ...@@ -15,10 +15,6 @@ const Store = gl.issueBoards.BoardsStore;
export default { export default {
props: { props: {
boardPath: {
type: String,
required: true,
},
canAdminBoard: { canAdminBoard: {
type: Boolean, type: Boolean,
required: true, required: true,
...@@ -130,7 +126,7 @@ export default { ...@@ -130,7 +126,7 @@ export default {
submit() { submit() {
if (this.isDeleteForm) { if (this.isDeleteForm) {
this.submitDisabled = true; this.submitDisabled = true;
this.$http.delete(this.boardPath) gl.boardService.deleteBoard(this.currentBoard)
.then(() => { .then(() => {
gl.utils.visitUrl(Store.rootPath); gl.utils.visitUrl(Store.rootPath);
}) })
...@@ -153,11 +149,11 @@ export default { ...@@ -153,11 +149,11 @@ export default {
Store.state.currentPage = ''; Store.state.currentPage = '';
}, },
resetFormState() { resetFormState() {
if (this.currentBoard && Object.keys(this.currentBoard).length && this.isEditForm) { if (this.isNewForm) {
Store.updateBoardConfig(this.currentBoard);
} else if (this.isNewForm) {
// Clear the form when we open the "New board" modal // Clear the form when we open the "New board" modal
Store.updateBoardConfig(); Store.updateBoardConfig();
} else if (this.currentBoard && Object.keys(this.currentBoard).length) {
Store.updateBoardConfig(this.currentBoard);
} }
}, },
}, },
......
...@@ -46,6 +46,10 @@ class BoardService { ...@@ -46,6 +46,10 @@ class BoardService {
return this.boards.save({}, { board }); return this.boards.save({}, { board });
} }
deleteBoard ({ id }) {
return this.boards.delete({ id });
}
all () { all () {
return this.lists.get(); return this.lists.get();
} }
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
Delete board Delete board
%board-form{ ":milestone-path" => "milestonePath", %board-form{ ":milestone-path" => "milestonePath",
"board-path" => current_board_path(board),
"labels-path" => labels_filter_path(true), "labels-path" => labels_filter_path(true),
"project-id" => @project&.id, "project-id" => @project&.id,
"group-id" => @group&.id, "group-id" => @group&.id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment