I am trying to setup a very simple query using Vue + Apollo (Postgraphile GraphQL server in the backend).
In my component I have (in the script tag):
import { CURRENT_USER_QUERY } from '../constants/graphql';
export default {
name: 'User',
data() {
return {
currentUser: undefined,
};
},
apollo: {
currentUser: CURRENT_USER_QUERY,
},
};
In ../contants/graphql
I have:
import gql from 'graphql-tag';
export const CURRENT_USER_QUERY = gql`
query CurrentUserQuery {
currentUser {
id
username
}
}
`;
In my Graphiql endpoint, the query above works without any problems.
However, when I run it in Vue, I get the following message on console:
[Vue warn]: Error in created hook: "TypeError:
this.getClient(...).watchQuery is not a function"
Searched everywhere and could not find anyone with a similar error...
Any clues? Where should I start looking at? Thanks!!