2022-09-09 11:53:35 +00:00
|
|
|
---
|
2022-09-22 09:37:49 +00:00
|
|
|
import { Root } from '../../../components/Root'
|
2022-09-09 11:53:35 +00:00
|
|
|
import Zine from '../../../layouts/zine.astro'
|
|
|
|
import { apiClient } from '../../../utils/apiClient'
|
2022-09-23 18:27:05 +00:00
|
|
|
import { initRouter } from '../../../stores/router'
|
2022-10-28 21:21:47 +00:00
|
|
|
import { PRERENDERED_ARTICLES_COUNT } from '../../../components/Views/Author'
|
2022-09-09 11:53:35 +00:00
|
|
|
|
|
|
|
const slug = Astro.params.slug.toString()
|
2022-10-28 21:21:47 +00:00
|
|
|
const articles = await apiClient.getArticlesForAuthors({ authorSlugs: [slug], limit: PRERENDERED_ARTICLES_COUNT })
|
2022-09-09 11:53:35 +00:00
|
|
|
const author = articles[0].authors.find((a) => a.slug === slug)
|
|
|
|
|
2022-09-23 18:27:05 +00:00
|
|
|
const { pathname, search } = Astro.url
|
|
|
|
initRouter(pathname, search)
|
|
|
|
|
2022-09-09 11:53:35 +00:00
|
|
|
Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate')
|
|
|
|
---
|
|
|
|
|
|
|
|
<Zine>
|
2022-10-05 15:11:14 +00:00
|
|
|
<Root authorArticles={articles} author={author} client:load />
|
2022-09-09 11:53:35 +00:00
|
|
|
</Zine>
|