import { graphql } from "react-apollo"
import gql from "graphql-tag"
import Component, {  } from "./component"

export const USER_INFO_QUERY = gql`
  {
    user {
      ...UserInfo
    }
  }
  ${Component.fragments.user}
`
export default graphql<any, any, any, any>(USER_INFO_QUERY, {
  props: ({ data }) => ({
    user: data ? data.user : null,
    loading: data ? data.loading : false
  }),
  options: () => ({
    context: {
      service: "nap"
    },
    fetchPolicy: "cache-and-network"
  })
})(Component)

export const userInfoFragment = Component.fragments.user
