Skip to content

Commit

Permalink
feat: implement resolver for related resources
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Aug 13, 2020
1 parent 5c8cc98 commit f4c8fd1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/gatsby-source-swiftype/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ exports.createSchemaCustomization = ({ actions }) => {
createTypes(typeDefs);
};

exports.createResolvers = ({ createResolvers }, pluginOptions) => {
const { file } = pluginOptions;

exports.createResolvers = ({ createResolvers }) => {
createResolvers({
Mdx: {
relatedResources: {
type: ['RelatedResource!'],
resolve(source, args, context, info) {
return [];
resolve(source, _args, context) {
return context.nodeModel
.getAllNodes({ type: 'RelatedResource' })
.filter((node) => node.parent === source.id);
},
},
},
Expand Down

0 comments on commit f4c8fd1

Please sign in to comment.