Refactor useQueryStore in queries.ts
This commit is contained in:
parent
fcfe012a02
commit
d06399ab54
@ -4,7 +4,7 @@ import gql from 'graphql-tag'
|
|||||||
import { useQuery } from '@apollo/client'
|
import { useQuery } from '@apollo/client'
|
||||||
|
|
||||||
export const useQueryStore = defineStore('query', () => {
|
export const useQueryStore = defineStore('query', () => {
|
||||||
const getUser = useQuery(gql`
|
const getUser = useQuery(gql`
|
||||||
query getUsers {
|
query getUsers {
|
||||||
users {
|
users {
|
||||||
id
|
id
|
||||||
@ -15,7 +15,20 @@ export const useQueryStore = defineStore('query', () => {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
return {
|
const { variables } = useQuery(gql`
|
||||||
getUser,
|
query getUserById ($id: ID!) {
|
||||||
|
user (id: $id) {
|
||||||
|
id
|
||||||
|
email
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
`, {
|
||||||
|
variables: {
|
||||||
|
id: 'abc-abc-abc',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
getUser,
|
||||||
|
}
|
||||||
})
|
})
|
Loading…
x
Reference in New Issue
Block a user