import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const PostPullRequest = gql` mutation PostPullRequest($pullRequestForm: PullRequestFormInput! , $owner: String, $repo: String) { postPullRequest(pullRequestForm: $pullRequestForm, owner: $owner, repo: $repo) { id url number html_url head { ref } } }` const GetPullRequest = gql` query GetPullRequest($owner: String, $repo: String, $page: Int) { getPullRequest(owner: $owner, repo: $repo, page: $page) { } }` const withAppSyncPullRequest = compose( graphql(GetPullRequest, { name: 'getPullRequest', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { owner: ownProps.owner, repo: ownProps.repo, page: ownProps.page } }), props: (props) => { if (props.getPullRequest.error) console.log(props.getPullRequest.error) return props } }) ) export { PostPullRequest, GetPullRequest, withAppSyncPullRequest }