Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
No able to update data using react + express

I'm trying to update data from ui but data does not update though it can be done using postman and in payload data is also being passed.

Here is handle submit function:

enter code here
        data.append("thingsTodo", values.thingsTodo);
        data.append("minDaysToSpent", values.minDaysToSpent);
        data.append("usp", values.usp);
        data.append("geoRegion", values.geoRegion.value);
        data.append("altitude", values.altitude);
        data.append("thingsToConsider", values.thingsToConsider);
      
        try {
          const response = await axios.put(`/api/place/${id}`, data).then((data)=>console.log(data,"data"));

controller:

        exports.updatePlace = async (req,res) => {
    try {
        let place = Place.findById(req.params.id)
        if(!place){
            return res.status(404).json({success:false,message:"Place does not exists"})
        }
        console.log(req.body)
        place = await Place.findByIdAndUpdate(req.params.id,req.body,{new:true})
        res.status(200).json({
            success:true,
            message:"Place Updated Successfully",
            place
        })
    } catch (error) {
        return res.status(500).json({
            success:false,
            error:error.message
        })
    }
    }

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!