import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const GetDelegatorsCount = gql` query GetDelegatorsCount($poolBech32Id: String) { getDelegatorsCount(poolBech32Id: $poolBech32Id) { delegators_count_total } }` const withAppSyncDelegatorsCount = compose( graphql(GetDelegatorsCount, { name: 'getDelegatorsCount', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { poolBech32Id: ownProps.poolBech32Id } }), props: (props) => { if (props.getDelegatorsCount.error) console.log(props.getDelegatorsCount.error) return props } }) ) export { GetDelegatorsCount, withAppSyncDelegatorsCount }