const slug = computed(() => route.params.slug);
const specificLocation = ref();
watch(slug, async () => {
console.log("slug changed", slug.value);
if (slug.value.length === 3) {
const { data: location } = await useLazyFetch(`/api/v2/locations/search`, {
params: {
countryCode: slug.value[0],
cityName: slug.value[1],
locationName: slug.value[2],
}
});
console.log("Location updated")
specificLocation.value = location.value;
}
}, {immediate: true})
const slug = computed(() => route.params.slug);
const specificLocation = ref();
watch(slug, async () => {
console.log("slug changed", slug.value);
if (slug.value.length === 3) {
const { data: location } = await useLazyFetch(`/api/v2/locations/search`, {
params: {
countryCode: slug.value[0],
cityName: slug.value[1],
locationName: slug.value[2],
}
});
console.log("Location updated")
specificLocation.value = location.value;
}
}, {immediate: true})