webapp/src/pages/topics.astro

16 lines
498 B
Plaintext
Raw Normal View History

2022-09-09 11:53:35 +00:00
---
import { AllTopicsPage } from '../components/Views/AllTopics'
import Zine from '../layouts/zine.astro'
import { apiClient } from '../utils/apiClient'
2022-09-14 15:44:06 +00:00
import { sortBy } from '../utils/sortby'
2022-09-09 11:53:35 +00:00
2022-09-14 15:44:06 +00:00
const { by } = Object.fromEntries(Astro.url.searchParams.entries())
let topics = await apiClient.getAllTopics()
topics = sortBy(topics, by || 'shouts')
2022-09-09 11:53:35 +00:00
Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate')
---
<Zine>
<AllTopicsPage topics={topics} client:load />
</Zine>