webapp/src/pages/index.astro

22 lines
705 B
Plaintext
Raw Normal View History

2022-09-09 11:53:35 +00:00
---
2022-11-13 09:25:31 +00:00
import Prerendered from '../main.astro'
2022-09-22 09:37:49 +00:00
import { Root } from '../components/Root'
2022-09-09 11:53:35 +00:00
import { apiClient } from '../utils/apiClient'
2022-09-23 18:27:05 +00:00
import { initRouter } from '../stores/router'
import { PRERENDERED_ARTICLES_COUNT } from '../components/Views/Home'
2022-09-09 11:53:35 +00:00
2022-09-22 09:37:49 +00:00
const randomTopics = await apiClient.getRandomTopics({ amount: 12 })
2022-11-15 14:24:50 +00:00
const articles = await apiClient.loadShoutsBy(
{ by: { visibility: "public" }, amount: PRERENDERED_ARTICLES_COUNT, offset: 0 })
2022-09-09 11:53:35 +00:00
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')
---
2022-11-13 09:25:31 +00:00
<Prerendered>
<Root randomTopics={randomTopics} shouts={articles} client:load />
2022-11-13 09:25:31 +00:00
</Prerendered>
2022-09-22 09:37:49 +00:00