How to replace 'useResult' in graphql with vue and apolo?

Viewed 25

I have to replace this useResult that is fetching data from graphql

const locationOptions = useResult(
       result,
       [],
       ({ getLocations }): Option[] => formatOptions(getLocations)
     )

and I want to change it for a computed function like

const locationOptions = computed(() => result.value.getLocations ?? [])

I was trying to use a watch to run the function but it seems not to be working

watch(locationOptions, () => {
      formatOptions(locationOptions.value)
    })

any suggestions?

0 Answers
Related