0
Schema
type Query {
launches: [Launch]
}
type Launch {
id: String!
mission_name: String
}
Interface
export interface launch {
launches: Launch[];
}
export interface Launch {
id: string;
mission_name: string;
}
Service file
async getlaunches(): Promise<any> {
console.log(JSON.stringify(this.launchEndpoint));
this.logger.info('Demonstrate masking of logged data:');
return await this.apiClient.post(this.launchEndpoint, {
query: '{ launches { id, mission_name } }',
});
}
the launchEndpoint is this public URL : https://spacex-production.up.railway.app/
resolver file
@Query('launches')
async getLaunches(): Promise<any> {
return this.apiclientService.getlaunches();
}
Controller file
@Get('launches')
getlaunches(): any {
return this.apiclientService.getlaunches();
}
I have already tried couple of hours on this issue but no help, let me know if anyone know how to solve it.
2
What is your
apiclientService
? Also, why are you returning aPromise<Observable<launch>>
? You should probably convert theObservable
to aPromise
or only useObservables
. There are use cases for when you need to mix the two, but this doesn't seem like one of them45 mins ago
@JayMcDoniel Okay i have changes the Observable and now just using the promise. apiclientService is just the service class where, i have other functions as well to fetch for other services. When i am just call this public api with my query in the code it working well, and giving me the results but when i am using the same through the apollo sandbox its not able to give me desired result.
19 mins ago
|