send move req to server
This commit is contained in:
@@ -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
@@ -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------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user