fetching JSON data
save
movieData: {}
......
retrieveMovieData (context, parameter) {
axios.get(API.movieData + parameter.id)
.then(response => {
context.commit('MOVIE_DATA', response.data)
})
.catch(error => {
console.log(error)
})
}
.js file
<template>
<section>
<div v-for="item in movieData">
<p>{{item.summary}}</p>
</div>
</section>
</template>
......
export default {
name: 'info',
computed: {
...mapState(['movieData'])
},
mounted () {
let _id = this.$route.params.id
this.$store.dispatch('retrieveMovieData', {
id: _id
})
}
}
I am trying to display information on my page, such as summary, but the chrome Dev tools console shows an error message "TypeError: Cannot read property 'summary' of null",
I have been attempting different methods.