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

216
Views
Uncaught (in promise) TypeError: Cannot set properties of undefined

So I'm using vue 2 for a project and I need to update an array that I named storychosen with the number of tests passed,failed and skipped for each story (I have a collection of tests that are grouped by story name) this is the method that I use to get that)

 getstoryresult(storyname) {
        const res=axios({
        method: "post",
        url: "http://localhost:3002/backend/storytests",
        data: {
          stname: storyname

        },
      }).then(function(result){
        console.log(result.data.data)
        var storypass=0
        var storyfail=0
        var storyskip=0
        for (let i in result.data.data){
          switch(result.data.data[i].status)
          {
            case 'passed':storypass++;break;
            case 'skipped':storyskip++;break;
            case 'failed':storyfail++;break;
          }
         
          
        }
        console.log(storypass,storyfail,storyskip)
         this.storychosen= [storypass, storyfail, storyskip] //storychosen is declared in data as an empty array
      })
        
      }

the post request return an array of tests and I just iterate over these tests and get the status of each test and increment one of the 3 status variables.

my problem is when i try to update the storychosen variable i get the error Uncaught (in promise) TypeError: Cannot set properties of undefined.I'm not used to working with promises so it might be a stupid question but how can I update the storychosen array in the .then function

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!