Skip to content

Commit

Permalink
fix(Vue-trello): rectify task drag between columns
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Sep 29, 2021
1 parent 6f632d0 commit b240f4f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions packages/vue-trello/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,11 @@ const store = createStore<State>({
toTaskIndex: number;
}
) {
if (fromColumnIndex !== toColumnIndex) {
const fromTasks = state.board.columns[fromColumnIndex].tasks;
const toTasks = state.board.columns[toColumnIndex].tasks;
const taskToMove = fromTasks.splice(fromTaskIndex, 1)[0];
toTasks.push(taskToMove);
} else {
const tasks = state.board.columns[fromColumnIndex].tasks;
const taskToMove = tasks.splice(fromTaskIndex, 1)[0];
tasks.splice(toTaskIndex, 0, taskToMove);
}
const fromTasks = state.board.columns[fromColumnIndex].tasks;
const toTasks = state.board.columns[toColumnIndex].tasks;
const taskToMove = fromTasks.splice(fromTaskIndex, 1)[0];
if (typeof toTaskIndex === 'undefined') toTasks.push(taskToMove);
else toTasks.splice(toTaskIndex, 0, taskToMove);
},
moveColumn(
state,
Expand Down

0 comments on commit b240f4f

Please sign in to comment.