Skip to content

Commit

Permalink
Fix for hardcoded routes needed to prerender
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofVDB1 committed Nov 28, 2023
1 parent b5439fd commit 6e15e30
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default defineNuxtConfig({
// define preset for nitro and which backend to serve the project
preset: "node-server",
prerender: {
crawlLinks: true,
ignore: ['/api']
}
},
Expand Down
7 changes: 2 additions & 5 deletions pages/geudenstraat/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@
<script setup lang="ts">
import type { Room } from '~/types/room'
const { path } = useRoute()
const { params } = useRoute()
const { data } = await useAsyncData('data', async () => {
const [data] = await Promise.all([
queryContent<Room>(`${path}configuration`).find(),
queryContent<Room>(`geudenstraat/${params?.slug[0]}/configuration`).find(),
])
console.log(`${path}/configuration`)
console.log(data[0])
return data[0]
})
// Redirect to 404 in case of no data
Expand Down
5 changes: 2 additions & 3 deletions pages/sloefke/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
<script setup lang="ts">
import type { Room } from '~/types/room'
const { path } = useRoute()
const { params } = useRoute()
const { data } = await useAsyncData('data', async () => {
const [data] = await Promise.all([
queryContent<Room>(`${path}configuration`).find(),
queryContent<Room>(`sloefke/${params?.slug[0]}/configuration`).find(),
])
console.log(data[0])
return data[0]
})
// Redirect to 404 in case of no data
Expand Down
1 change: 0 additions & 1 deletion pages/sloefke/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const { data } = await useAsyncData('data', async () => {
})
// Redirect to 404 in case of no data
if (!data.value) {
console.log(data)
throw createError({ statusCode: 404, statusMessage: 'Page not found' })
}
</script>

0 comments on commit 6e15e30

Please sign in to comment.