I decided to wrap up the GraphQLModule
that is created by ng add apollo-angular
into our own Angular Shared Module.
https://www.apollographql.com/docs/angular/basics/setup/#installation-with-angular-schematics
While performing queries inside of this module, I receive responses from the server.
However, when using this module in another application, we receive no response or errors:
myQuery = gql`
{
member {
id
details {
id
}
}
}
`
queryOptions: WatchQueryOptions = {query: this.myQuery, errorPolicy: 'all'}
myQueryObs: Observable<any>
constructor(private apollo: Apollo) {}
ngOnInit() {
this.myQueryObs = this.apollo.watchQuery<Query>(this.queryOptions)
.valueChanges.pipe(map (results => {
if (results.errors) {
console.log('ERRORS!!! YAY!!!') // NEVER GET HERE
}
console.log('RESULTS') // NEVER GET HERE EITHER
}));
}
I've logged the crap out of it and cannot determine why it is not responding at all. It acts like Apollo is not instantiated at all, but console output proves otherwise.
Any advice or help is greatly appreciated!