const route = useRoute();
// skip fetching if route param `id` does not exist
const shouldSkip = computed(() => {
return !route.params.id
});
const { data, isFetching } = useQuery({
// pass as ref ...
skip: shouldSkip,
});
// pass as a function, which rescives the current variables as an argument
const { data, isFetching } = useQuery({
// ...,
skip: (variables) => {
return !variables.id;
},
});
const route = useRoute();
const { data, isFetching } = useQuery({
variables: () => {
return { id: route.params.id };
},
});