send move req to server
This commit is contained in:
@@ -206,6 +206,12 @@ function App() {
|
||||
const moveItem = async (itemID, boxIDTarget) => {
|
||||
//post req
|
||||
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) => {
|
||||
|
||||
+3
-2
@@ -113,9 +113,10 @@ app.delete('/box/:boxId/item/:itemId', async (request, response) => {
|
||||
});
|
||||
|
||||
//move item
|
||||
app.post('/box/:boxIdSource/item/:itemId/to/:boxIdTarget', async (request, response) => {
|
||||
const sourceBoxID = request.params.boxIdSource;
|
||||
app.post('/box/item/:itemId/:boxIdTarget', async (request, response) => {
|
||||
const itemID = request.params.itemId;
|
||||
const targetBoxID = request.params.boxIdTarget;
|
||||
response.send({itemID,targetBoxID});
|
||||
/*...*/
|
||||
})
|
||||
/*------------/CONTROLLER------------*/
|
||||
|
||||
Reference in New Issue
Block a user