import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import gql from 'graphql-tag'
import { useQuery } from '@vue/apollo-composable'

export const useQueryStore = defineStore('query', () => {
  const getUser = useQuery(gql`
      query getUsers {
        users {
          id
          firstname
          lastname
          email
        }
      }
    `)

  const { variables } = useQuery(gql`
    query getUserById ($id: ID!) {
      user (id: $id) {
        id
        email
      }
    }
  `, {
    variables: {
      id: 'abc-abc-abc',
    }
  })

  return {
    getUser,
  }
})