Skip to content

Commit

Permalink
feat(useQuery): refetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Nov 29, 2019
1 parent bfb5d08 commit e77518a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/vue-apollo-composable/src/useQuery.ts
Expand Up @@ -162,6 +162,17 @@ export function useQuery<
deep: true,
})

// Fefetch

function refetch (variables: TVariables = null) {
if (query.value) {
if (variables) {
currentVariables = variables
}
return query.value.refetch(variables)
}
}

// Subscribe to more

const subscribeToMoreItems: SubscribeToMoreItem[] = []
Expand Down Expand Up @@ -242,6 +253,7 @@ export function useQuery<
variables: variablesRef,
options: optionsRef,
query,
refetch,
subscribeToMore,
}
}

0 comments on commit e77518a

Please sign in to comment.