I have a simple route for testing purposes which looks like this:
exports.looseAllPendingBets = (req, res) => {
let array = JSON.stringify(req.body.arrayToDelete)
console.log(array)
};
I then pass an array of object from my client like this:
<form action="http://localhost:4000/user/looseAllPendingBets" method="post">
<input type="hidden" :value="selected" name="arrayToDelete">
<button type="submit" class="btn btn-outline-danger">All selected = Lost</button>
</form>
The bind value :selected is an array of objects like this:
selected: [{"id": "61277276d8b2b2000482fc39", "amount": "16"}, {"id": "612772d3d8b2b2000482fc3c", "amount": "15" }]
But for some reason when I console.log(array) in the route, it gives me [object Object].
I have tried JSON.stringify() like shown above, and also array[0] and array[0].id but this gives me undefined.
Been struggeling with this for a while. Please note I'm still new to this type of development. Thank you.