[Vuejs]-Cannot read property 'map' of undefined in Express, VueJS

0👍

Check your EkonomiService.js class. Try this code:

result = new Promise((resolve, reject) => {
  axios.get(url)
    .then((result) => {
      const res = result.data.map((product) => {
        return {...product};
      })
      resolve(res);
    }).catch((error) => {
      if(typeof(error) == 'object'){
        alert(error)
      }
      reject(error.data);
    });
});

Leave a comment