From 6d72ee24adc3fd83685b3dbddf6e06923f12cbb1 Mon Sep 17 00:00:00 2001 From: "np.w" Date: Fri, 19 Feb 2021 20:11:20 -0600 Subject: [PATCH] do not allow move item to source box --- client/src/app.js | 5 ++++- server/server.js | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/app.js b/client/src/app.js index 6a64466..b4af277 100644 --- a/client/src/app.js +++ b/client/src/app.js @@ -33,6 +33,7 @@ function App() { const [isMoving, setIsMoving] = useState(false); const [moveItemID, setMoveItemID] = useState(null); + const [moveItemBoxID, setMoveItemBoxID] = useState(null); //fetch all box data useEffect(() => { @@ -182,6 +183,7 @@ function App() { return false; } const handleSelectMoveBox = async (boxData, event) => { + setMoveItemBoxID(null); setMoveItemID(null); setIsMoving(false); await moveItem(moveItemID,boxData._id); @@ -272,6 +274,7 @@ function App() { setShowModalItem(true); } const handleMoveItem = (boxID, itemID) => { + setMoveItemBoxID(boxID); setMoveItemID(itemID); setIsMoving(true); /*highlight which boxes available to move to*/ @@ -396,7 +399,7 @@ function App() { {filteredData.map((box, index) => { return ( { const box = await getBox(boxID); response.send(box); }); - //move item app.post('/box/item/:itemId/:boxIdTarget', async (request, response) => { const itemID = request.params.itemId;