Getting Previou Load Error even when the page is loaded. In this screenshot you can see that the preview is loaded:
Here is the code of this page:
<!-- pages/landing/[slug].vue -->
<script setup>
import { Content, fetchOneEntry, isPreviewing } from '@builder.io/sdk-vue';
import { ref } from 'vue';
const route = useRoute();
// TO DO: Add your Public API Key here
const apiKey = 'xxxxxxxxxx';
const canShowContent = ref(false);
const model = 'page';
const { data: content } = await useAsyncData('builderData', () =>
fetchOneEntry({
model,
apiKey,
userAttributes: {
urlPath: route.path,
},
})
);
canShowContent.value = content.value ? true : isPreviewing(route.path);
</script>
<template>
<div v-if="canShowContent">
<Content :api-key="apiKey" :model="model" :content="content" />
</div>
<div v-else>Content not Found</div>
</template>
I have masked the apiKey in the above code.
What could be wrong?