Skip to content

Instantly share code, notes, and snippets.

@phpsmarter
Created March 10, 2018 16:31
Show Gist options
  • Save phpsmarter/9c9cfa043aace317e4830cb48f5c586f to your computer and use it in GitHub Desktop.
Save phpsmarter/9c9cfa043aace317e4830cb48f5c586f to your computer and use it in GitHub Desktop.
function (root, args, context, info) {
return __awaiter(_this, void 0, void 0, function () {
var fragments, document, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
fragments = Object.keys(info.fragments).map(function (fragment) { return info.fragments[fragment]; });
document = {
kind: graphql_1.Kind.DOCUMENT,
definitions: [info.operation].concat(fragments),
};
return [4 /*yield*/, fetcher({
query: graphql_2.print(document),
variables: info.variableValues,
context: { graphqlContext: context },
})];
case 1:
result = _a.sent();
return [2 /*return*/, errors_1.checkResultAndHandleErrors(result, info)];
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment