import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const GetBlob = gql` query GetBlob($owner: String, $repo: String, $sha: String) { getBlob(owner: $owner, repo: $repo, sha: $sha) { content encoding url sha size } }` const PostBlob = gql` mutation PostBlob($blobForm: BlobFormInput! , $owner: String, $repo: String) { postBlob(blobForm: $blobForm, owner: $owner, repo: $repo) { url sha } }` const withAppSyncBlob = compose( graphql(GetBlob, { name: 'getBlob', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { owner: ownProps.owner, repo: ownProps.repo, sha: ownProps.sha } }), props: (props) => { if (props.getBlob.error) console.log(props.getBlob.error) return props } }) ) export { GetBlob, PostBlob, withAppSyncBlob }