Files
vue-journal-layer/app/journal-pages/AuthorPage.vue
Jakub Zych 6f6792f51c feat: scaffold Journal layer with configurable post route and git-install check
- journal module registers the Journal pages at journal.routes paths
- typed anonymous-GET client, html gate, SSR x-forwarded-for forwarding
- fixture API, built-server SSR smoke and git-tag install check
2026-10-09 17:31:45 +02:00

22 lines
754 B
Vue

<script setup lang="ts">
// journal-author: an author and their posts; an unknown author is a 404.
const route = useRoute()
const api = useJournalApi()
const slug = String(route.params.author ?? '')
const { data } = await useAsyncData(`journal-author-${slug}`, async () => {
const author = await api.getAuthor(slug)
if (!author) return null
return { author, page: await api.listAuthorPosts(slug) }
})
if (!data.value) throw createError({ statusCode: 404, fatal: true })
</script>
<template>
<section v-if="data" class="journal-author">
<h1>{{ data.author.first_name }} {{ data.author.last_name }}</h1>
<ul v-if="data.page">
<li v-for="post in data.page.data" :key="post.id">{{ post.title }}</li>
</ul>
</section>
</template>