send move req to server

This commit is contained in:
np.w
2021-02-19 18:56:56 -06:00
parent bf5a5f9aea
commit a0c1c5868e
2 changed files with 9 additions and 2 deletions
+6
View File
@@ -206,6 +206,12 @@ function App() {
const moveItem = async (itemID, boxIDTarget) => { const moveItem = async (itemID, boxIDTarget) => {
//post req //post req
console.log(`move item: ${itemID} to box ${boxIDTarget}`); console.log(`move item: ${itemID} to box ${boxIDTarget}`);
try {
const response = await axios.post(`${api.baseApiUrl}/item/${itemID}/${boxIDTarget}`);
}
catch(error) {
console.log(error);
}
} }
const createItem = async (boxID, itemData) => { const createItem = async (boxID, itemData) => {
+3 -2
View File
@@ -113,9 +113,10 @@ app.delete('/box/:boxId/item/:itemId', async (request, response) => {
}); });
//move item //move item
app.post('/box/:boxIdSource/item/:itemId/to/:boxIdTarget', async (request, response) => { app.post('/box/item/:itemId/:boxIdTarget', async (request, response) => {
const sourceBoxID = request.params.boxIdSource; const itemID = request.params.itemId;
const targetBoxID = request.params.boxIdTarget; const targetBoxID = request.params.boxIdTarget;
response.send({itemID,targetBoxID});
/*...*/ /*...*/
}) })
/*------------/CONTROLLER------------*/ /*------------/CONTROLLER------------*/