From d6597270dd15638a661a56d6381f71909db82c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Gaud=C3=A9?= Date: Wed, 17 Jun 2020 11:15:55 +0200 Subject: [PATCH] Fixe erreur lors du deplacement d'un ticket d'une colonne a une autre --- client/src/components/BoardPage/BoardPage.tsx | 2 +- client/src/store/reducers/kanboards.ts | 12 ++++++------ client/src/store/sagas/kanboards.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/src/components/BoardPage/BoardPage.tsx b/client/src/components/BoardPage/BoardPage.tsx index 087cc1c..3ce8806 100644 --- a/client/src/components/BoardPage/BoardPage.tsx +++ b/client/src/components/BoardPage/BoardPage.tsx @@ -228,7 +228,7 @@ export class BoardPage extends React.Component { e.currentTarget.closest('.react-kanban-column').classList.toggle('minimized'); } - onCardDragEnd(b: any, card: any, source: any, dest: any) { + onCardDragEnd(card: any, source: any, dest: any) { const { board } = this.props; this.props.dispatch(moveCard( board.id, diff --git a/client/src/store/reducers/kanboards.ts b/client/src/store/reducers/kanboards.ts index ebe5474..4d1ff08 100644 --- a/client/src/store/reducers/kanboards.ts +++ b/client/src/store/reducers/kanboards.ts @@ -37,22 +37,22 @@ function handleMoveCard(state: any, action: any) { const kanboard = state.byID[boardID]; - const lanes = [ ...kanboard.columns ]; - const fromLane = lanes[fromLaneID]; - const toLane = lanes[toLaneID]; + const columns = [ ...kanboard.columns ]; + const fromLane = columns[fromLaneID]; + const toLane = columns[toLaneID]; const card = fromLane.cards[fromPosition]; const fromCards = [ ...fromLane.cards ]; if (fromLaneID !== toLaneID) { fromCards.splice(fromPosition, 1); - lanes[fromLaneID] = { + columns[fromLaneID] = { ...fromLane, cards: fromCards, }; const toCards = [ ...toLane.cards ]; toCards.splice(toPosition, 0, card); - lanes[toLaneID] = { + columns[toLaneID] = { ...toLane, cards: toCards, }; @@ -67,7 +67,7 @@ function handleMoveCard(state: any, action: any) { ...state.byID, [boardID]: { ...state.byID[boardID], - lanes, + columns, }, } }; diff --git a/client/src/store/sagas/kanboards.ts b/client/src/store/sagas/kanboards.ts index bae3769..f510af2 100644 --- a/client/src/store/sagas/kanboards.ts +++ b/client/src/store/sagas/kanboards.ts @@ -22,7 +22,7 @@ export function* moveCardSaga(action: any) { } }); - const toLane = kanboard.lanes[toLaneID]; + const toLane = kanboard.columns[toLaneID]; const card = toLane.cards[toPosition]; if (!card) return;