import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const PostAdventure = gql` mutation PostAdventure($adventure: adventure) { postAdventure(adventure: $adventure) { guid name description location participants { person items { name size description type } } pack_lists { name size description type } } }` const GetAdventure = gql` query GetAdventure($guid: String, $name: String) { getAdventure(guid: $guid, name: $name) { } }` const GetAdventure = gql` query GetAdventure($guid: String) { getAdventure(guid: $guid) { guid name description location participants { person items { name size description type } } pack_lists { name size description type } } }` const withAppSyncAdventure = compose( graphql(GetAdventure, { name: 'getAdventure', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { guid: ownProps.guid, name: ownProps.name } }), props: (props) => { if (props.getAdventure.error) console.log(props.getAdventure.error) return props } }) ) export { PostAdventure, GetAdventure, GetAdventure, withAppSyncAdventure }