feat(useMutation): called ref

This commit is contained in:
Guillaume Chau 2019-11-29 16:33:20 +01:00
parent 9aa26a96af
commit bfb5d08c69

View File

@ -22,6 +22,7 @@ export function useMutation<
const loading = ref<boolean>(false)
const error = ref<Error>(null)
const called = ref<boolean>(false)
// Apollo Client
const { resolveClient } = useApolloClient()
@ -36,6 +37,7 @@ export function useMutation<
const client = resolveClient(currentOptions.clientId)
error.value = null
loading.value = true
called.value = true
try {
const result = await client.mutate({
mutation: document,
@ -58,5 +60,6 @@ export function useMutation<
mutate,
loading,
error,
called,
}
}