ugly astro subrouter
This commit is contained in:
parent
64443342a6
commit
55ccd419e2
|
@ -21,7 +21,7 @@ export const SearchPage = (props: Props) => {
|
|||
setQuery(ev.target.value)
|
||||
}
|
||||
|
||||
const handleSubmit = (ev) => {
|
||||
const handleSubmit = (_ev) => {
|
||||
// TODO page
|
||||
// TODO sort
|
||||
loadSearchResults({ query: getQuery() })
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { ArticlePage } from '../components/Views/ArticlePage'
|
||||
import Zine from '../layouts/zine.astro'
|
||||
import { apiClient } from '../utils/apiClient'
|
||||
|
||||
const slug = Astro.params.slug as string
|
||||
|
||||
if (slug.includes('/') || slug.includes('.map')) {
|
||||
|
|
|
@ -3,8 +3,8 @@ import { AuthorPage } from '../../../components/Views/Author'
|
|||
import Zine from '../../../layouts/zine.astro'
|
||||
import { apiClient } from '../../../utils/apiClient'
|
||||
|
||||
const limit = parseInt(Astro.params?.limit as string, 10) || 50
|
||||
const offset = parseInt(Astro.params?.offset as string, 10) || 0
|
||||
const limit = 50
|
||||
const offset = 0
|
||||
const slug = Astro.params.slug.toString()
|
||||
const articles = await apiClient.getArticlesForAuthors({ authorSlugs: [slug], offset, limit })
|
||||
const author = articles[0].authors.find((a) => a.slug === slug)
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
import { AllAuthorsPage } from '../components/Views/AllAuthors'
|
||||
import Zine from '../layouts/zine.astro'
|
||||
import { apiClient } from '../utils/apiClient'
|
||||
import { byCreated, sortBy } from '../utils/sortby'
|
||||
|
||||
const authors = await apiClient.getAllAuthors()
|
||||
|
||||
const { by } = Object.fromEntries(Astro.url.searchParams.entries())
|
||||
let authors = await apiClient.getAllAuthors()
|
||||
authors = sortBy(authors, by || byCreated)
|
||||
Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate')
|
||||
---
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import { FeedPage } from '../../components/Views/Feed'
|
|||
import Zine from '../../layouts/zine.astro'
|
||||
import { apiClient } from '../../utils/apiClient'
|
||||
|
||||
const limit = parseInt(Astro.params?.limit as string, 10) || 50
|
||||
const offset = parseInt(Astro.params?.offset as string, 10) || 0
|
||||
const limit = 50
|
||||
const offset = 0
|
||||
const recentArticles = await apiClient.getRecentArticles({ limit, offset })
|
||||
const shoutSlugs = recentArticles.map((s) => s.slug)
|
||||
const reactions = await apiClient.getReactionsForShouts({ shoutSlugs })
|
||||
|
|
|
@ -3,8 +3,8 @@ import { HomePage } from '../components/Views/Home'
|
|||
import Zine from '../layouts/zine.astro'
|
||||
import { apiClient } from '../utils/apiClient'
|
||||
|
||||
const limit = parseInt(Astro.params?.limit as string, 10) || 50
|
||||
const offset = parseInt(Astro.params?.offset as string, 10) || 0
|
||||
const limit = 50
|
||||
const offset = 0
|
||||
const randomTopics = await apiClient.getRandomTopics()
|
||||
const recentPublished = await apiClient.getRecentPublishedArticles({ limit, offset })
|
||||
const topMonth = await apiClient.getTopMonthArticles()
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
import { AllTopicsPage } from '../components/Views/AllTopics'
|
||||
import Zine from '../layouts/zine.astro'
|
||||
import { apiClient } from '../utils/apiClient'
|
||||
import { sortBy } from '../utils/sortby'
|
||||
|
||||
const topics = await apiClient.getAllTopics()
|
||||
|
||||
const { by } = Object.fromEntries(Astro.url.searchParams.entries())
|
||||
let topics = await apiClient.getAllTopics()
|
||||
topics = sortBy(topics, by || 'shouts')
|
||||
Astro.response.headers.set('Cache-Control', 's-maxage=1, stale-while-revalidate')
|
||||
---
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { createRouter, createSearchParams } from '@nanostores/router'
|
||||
import { atom, computed, onMount } from 'nanostores'
|
||||
import { createEffect } from 'solid-js'
|
||||
import { isServer } from 'solid-js/web'
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user