import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const GetMapRoute = gql` query GetMapRoute($lat: Float, $lng: Float) { getMapRoute(lat: $lat, lng: $lng) { lat lng } }` const GetMapRoute = gql` query GetMapRoute($points: String) { getMapRoute(points: $points) { polyline distance } }` const withAppSyncMapRoute = compose( graphql(GetMapRoute, { name: 'getMapRoute', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { lat: ownProps.lat, lng: ownProps.lng } }), props: (props) => { if (props.getMapRoute.error) console.log(props.getMapRoute.error) return props } }) ) export { GetMapRoute, GetMapRoute, withAppSyncMapRoute }