Last active
April 10, 2016 03:35
-
-
Save clayallsopp/5bb3718745864a6d3b54b0eec028f853 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const resolveType = (data) => { | |
if (data.username) { | |
return UserType; | |
} | |
if (data.director) { | |
return MovieType; | |
} | |
if (data.author) { | |
return BookType; | |
} | |
}; | |
const SearchableType = new GraphQLUnionType({ | |
name: 'SearchableType', | |
types: [ UserType, MovieType, BookType ], | |
resolveType: resolveType | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment