Skip to content

Instantly share code, notes, and snippets.

@sarahsweat
Last active June 7, 2019 18:09
Show Gist options
  • Save sarahsweat/a9954a9b032afd86e9cd3115f5fa1ea6 to your computer and use it in GitHub Desktop.
Save sarahsweat/a9954a9b032afd86e9cd3115f5fa1ea6 to your computer and use it in GitHub Desktop.
import { gql } from 'apollo-boost'
const RECIPE_ATTRIBUTES = gql`
fragment recipeResults on Recipe {
id
title
directions
ingredients
bylines {
id
title
imageUrl
}
image {
id
title
url
}
}
`
export const GET_RECIPE = gql`
query Search($id: String!) {
search(q: $id, brand: FOOD, types: RECIPE) {
results {
...recipeResults
}
}
}
${RECIPE_ATTRIBUTES}
`
export const GET_RECIPES = gql`
query Search($searchInput: String!) {
search(q: $searchInput, brand: FOOD, types: RECIPE, limit: 50) {
count
pageInfo {
endCursor
hasNextPage
}
results {
...recipeResults
}
}
}
${RECIPE_ATTRIBUTES}
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment