import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const GetCode = gql` query GetCode($orgKey: String, $applicationKey: String, $version: String, $generatorKey: String) { getCode(orgKey: $orgKey, applicationKey: $applicationKey, version: $version, generatorKey: $generatorKey) { generator { service { guid uri audit } generator } source files } }` const withAppSyncCode = compose( graphql(GetCode, { name: 'getCode', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { orgKey: ownProps.orgKey, applicationKey: ownProps.applicationKey, version: ownProps.version, generatorKey: ownProps.generatorKey } }), props: (props) => { if (props.getCode.error) console.log(props.getCode.error) return props } }) ) export { GetCode, withAppSyncCode }