enable ssr for those

This commit is contained in:
tonyrewin 2022-11-15 12:38:12 +03:00
parent bfd931f98f
commit d47396bb9c
2 changed files with 32 additions and 6 deletions

View File

@ -1,14 +1,27 @@
import { PageWrap } from '../_shared/PageWrap'
import { AllAuthorsView } from '../Views/AllAuthors'
import type { PageProps } from '../types'
import { ClientContainer } from '../_shared/ClientContainer'
import { createSignal, onMount, Show } from 'solid-js'
import { loadAllAuthors } from '../../stores/zine/authors'
import { Loading } from '../Loading'
export const AllAuthorsPage = (props: PageProps) => {
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.allAuthors))
onMount(async () => {
if (isLoaded()) {
return
}
await loadAllAuthors()
setIsLoaded(true)
})
return (
<PageWrap>
<ClientContainer>
<Show when={isLoaded()} fallback={<Loading />}>
<AllAuthorsView authors={props.allAuthors} />
</ClientContainer>
</Show>
</PageWrap>
)
}

View File

@ -1,14 +1,27 @@
import { PageWrap } from '../_shared/PageWrap'
import { AllTopicsView } from '../Views/AllTopics'
import type { PageProps } from '../types'
import { ClientContainer } from '../_shared/ClientContainer'
import { createSignal, onMount, Show } from 'solid-js'
import { loadAllTopics } from '../../stores/zine/topics'
import { Loading } from '../Loading'
export const AllTopicsPage = (props: PageProps) => {
const [isLoaded, setIsLoaded] = createSignal<boolean>(Boolean(props.allTopics))
onMount(async () => {
if (isLoaded()) {
return
}
await loadAllTopics()
setIsLoaded(true)
})
return (
<PageWrap>
<ClientContainer>
<Show when={isLoaded()} fallback={<Loading />}>
<AllTopicsView topics={props.allTopics} />
</ClientContainer>
</Show>
</PageWrap>
)
}