Private Axios Code
```axiosPrivate.interceptors.request.use(function (config) {
if(!config.headers.authorization){
config.headers.authorization = `Bearer ${localStorage.getItem('accessToken')}`
}
return config;
}```
Frontend React code
```const userInfo = user.email
const delivery = {img,name,price,seller,stock}
axiosprivate.put(`http://localhost:4000/stock/${productId}`, delivery,
userInfo)```
Node Express Code
```const token = headerAuth.split(' ')[1]
jwt.verify(token,process.env.ACCESS_TOKEN_JWT, (err,decoded) => {
if(err) return res.status(403).send({message: 'forbidden access'})
req.decoded = decoded
next()
})```
and
```app.put('/stock/:id', JWTAccess, async (req, res)=>{
const decodedEmail = req.decoded.email
const email = req.body
if(email === decodedEmail){
const id = req.params.id
const filter = {_id : ObjectId(id)}
const updatedPD = req.body
const options = { upsert: true };
const updateDoc = {
$set: updatedPD
}
const result = await productCollection.updateOne(filter, updateDoc,
options)
res.send(result)
}
else{
res.status(403).send({message: 'forbidden access'})
}
})```
Please guide me, on how can I send from react js Axios put & post method sending parameter so that I will be able to receive the parameter at the backend.
Thanks in advance!