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

195
Views
Strapi put request using Axios

I am trying to implement a feature where the stock of a product goes down. Right now I do this using a button. The problem now lies with how I do this. I am using strapi as my CMS and want to update a value called "stock" whenever I click the button. The PUT request seems to work fine and strapi indicates the product has been updated. But the value I passed through didn't get changed.

Here is my code

const handlePut = () => {
  axios.get('https://strapi.***.com/api/kledings/1').then(res => {
  
  let obj = res.data
  obj.data.attributes.stock -= 1

  axios.put('https://strapi.***.com/api/kledings/1', obj).then(res => {
      console.log(res.data, 'updated');
    })
  })
}

Strapi's response to this put request is received with status 200:

enter image description here

My initial stock was 10 and by using handlePut() it should be 9 now. Instead my strapi dashboard shows the following: enter image description here

So it does show that it has been updated but no values are changes. Does anyone know what I am currently missing?

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!