I'm practicing Graphql & Apollo Client for Angular.
I'm having issues in creating queries from client side.
I've successfully created graphql queries in backend.
Below is my GQL Query which returns data and it's displayed in Playground
GQL Query
{
getData {
data {
type
}
}
My Client side code,
Service.ts
export class ContentService {
constructor( private apollo: Apollo,
) {
this.getContent();
}
async getContent(): Promise<any> {
const response: any = await this.apollo.query({query: getContentQuery}).toPromise();
return console.log(response);
}
}
Please tell me what I'm doing wrong over here.
Unable to find the solutions answer. Please help.