I am frontend developer so for the first time I got my hands on vue and graphql, I don’t know how exactly to deal with this error:
Missing getMovies attribute on result {movies: Array(20)}
Here is my code, and I can see the data is fetched successfully in the response on dev tools in chrome:
{"data":{"movies":[{"__typename":"Movie","id":11,"overview":
Here is the code:
<template>
<div class="hello">
<ul>
<li v-for="movie in movies" :key="movie.id">{{movie.title}}</li>
</ul>
</div>
</template>
<script>
import gql from 'graphql-tag'
export default {
name: 'HelloWorld',
data(){
return {
movies: []
}
},
apollo: {
getMovies: {
query: gql`
query StarWars {
movies(query: "Star Wars") {
title
overview
poster_path
id
}
}
`,
result({data}){
this.movies = data.movies
}
}
},
props: {
msg: String
}
}
</script>