Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

215
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda