import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const GetContents = gql` query GetContents($owner: String, $repo: String, $ref: String) { getContents(owner: $owner, repo: $repo, ref: $ref) { type encoding size name path content sha url git_url html_url download_url } }` const GetContents = gql` query GetContents($owner: String, $repo: String, $path: String, $ref: String) { getContents(owner: $owner, repo: $repo, path: $path, ref: $ref) { type encoding size name path content sha url git_url html_url download_url } }` const withAppSyncContents = compose( graphql(GetContents, { name: 'getContents', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { owner: ownProps.owner, repo: ownProps.repo, ref: ownProps.ref } }), props: (props) => { if (props.getContents.error) console.log(props.getContents.error) return props } }) ) export { GetContents, GetContents, withAppSyncContents }