Fedox
Fedox
NNuxt
Created by Fedox on 5/27/2025 in #❓・help
Page loads twice
Heya, I currently have the problem that my page loads 2 times as soon as I enter it, here is my script part:
<script lang="ts" setup>
const route = useRoute()
const name = route.params.name as string

const prettyName = name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, ' ')

useHead({
title: prettyName,
meta: [
{
name: 'description',
content: `Entdecke die Kategorie ${prettyName} im Timolia-Shop!`,
},
],
})

const config = useRuntimeConfig()
const url = `https://headless.tebex.io/api/accounts/${config.public.tebex}/categories?includePackages=1`

const data = await $fetch(url)
const category = computed(() => {
return data?.data.find((cat: any) => cat.slug === name) || null
})
</script>
<script lang="ts" setup>
const route = useRoute()
const name = route.params.name as string

const prettyName = name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, ' ')

useHead({
title: prettyName,
meta: [
{
name: 'description',
content: `Entdecke die Kategorie ${prettyName} im Timolia-Shop!`,
},
],
})

const config = useRuntimeConfig()
const url = `https://headless.tebex.io/api/accounts/${config.public.tebex}/categories?includePackages=1`

const data = await $fetch(url)
const category = computed(() => {
return data?.data.find((cat: any) => cat.slug === name) || null
})
</script>
And I have attached another video which shows this error. (I have limited the internet speed so that you can see it better)
6 replies