Skip to content

[vue-apollo] An error has occured for query 'getTeam' #461

Open
@thanhthinhmai

Description

@thanhthinhmai

Hi, I am working vue-apollo, currently I having issues:
In file Workspace.vue

<script>
    import { GetTeam } from '../constants/query.gql'
    export default  {
        name: 'Workspace',
        data() {
            return {
                getTeam: {}
            }
        },
        apollo: {
            getTeam: {
                query: GetTeam
            }
        }
   }
</script>

......
In file query.gql

query GetTeam {
     getTeam {
       id
      name
    }
}
//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 {
  ......
}

Is there a way to fix the issue?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions