I encounter the classical nuxt instance not available
error when server side rendering a nuxt page containing the following logic:
<script setup>
const getImageOne = async () => {
return await useFetch('https://dog.ceo/api/breeds/image/random');
};
const getImageTwo = async () => {
return await useFetch('https://dog.ceo/api/breeds/image/random');
};
const getImages = async () => {
return [await getImageOne(), await getImageTwo()];
};
const responses = await getImages();
const dogOne = responses?.[0]?.data?.value;
const dogTwo = responses?.[1]?.data?.value;
</script>
<template>
<div>
<p>Dog 1: {{ dogOne }}</p>
<p>Dog 2: {{ dogTwo }}</p>
</div>
</template>
The issue seems to be that useFetch is called twice in one method call.