Add useQueryStore to handle GraphQL queries
This commit is contained in:
21
src/stores/queries.ts
Normal file
21
src/stores/queries.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import gql from 'graphql-tag'
|
||||
import { useQuery } from '@apollo/client'
|
||||
|
||||
export const useQueryStore = defineStore('query', () => {
|
||||
const getUser = useQuery(gql`
|
||||
query getUsers {
|
||||
users {
|
||||
id
|
||||
firstname
|
||||
lastname
|
||||
email
|
||||
}
|
||||
}
|
||||
`)
|
||||
|
||||
return {
|
||||
getUser,
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user