data source options builder
This commit is contained in:
parent
44def3a9fc
commit
a6e3f0999e
@ -40,6 +40,7 @@ export class GraphQLDataSourceOptionsBuilder<TModel, TKey> {
|
||||
let ret: IDataSourceQueryAdapterOptions<TModel> = {
|
||||
adapter: <IAdvanceQueryAdapter<IQueryCriteria, TModel>>{
|
||||
handle: (query: IQueryCriteria) => {
|
||||
|
||||
const advanceQuery = this.createGraphQLQueryCriteria(query);
|
||||
const o$ = this.apollo.query<any>({
|
||||
query: this.createGraphQLQuery(query),
|
||||
@ -47,14 +48,11 @@ export class GraphQLDataSourceOptionsBuilder<TModel, TKey> {
|
||||
criteria: advanceQuery
|
||||
}
|
||||
});
|
||||
|
||||
return o$.pipe(
|
||||
map(result => {
|
||||
const queryResult = result.data[this.queryName] as IGraphQLAdvanceQueryResult<TModel>;
|
||||
return this.queryResultFromGraphQLAdvancedResult(query, queryResult);
|
||||
}),
|
||||
catchError(err => {
|
||||
console.error(err);
|
||||
return err;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user