I am working vue-apollo, currently I am having issues:
<script>
import { GetTeam } from '../constants/query.gql'
export default {
name: 'Workspace',
data() {
return {
getTeam: {}
}
},
apollo: {
getTeam: {
query: GetTeam
}
}
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
query GetTeam {
getTeam {
id
name
}
}
I am facing the below error
[vue-apollo]:An error has occured for query getTeam
Is there a way to fix the issue?
//resolvers.js
const resolvers = {
Query: {
async getTeam(_, args, context) {
const userId = getUserId(context)
const user = await User.findById(userId)
return await Team.findById(user.team)
}
}
//schema.graphql
type Team {
id: String!
name: String!
}
type User {
......
}
Running:
npm install --no-save apollo-utilities@1.0.22
Solved the issue for me. See https://github.com/apollographql/apollo-client/issues/4125