updated to next 9.3.0

This commit is contained in:
tmshv committed 2020-03-10 19:13:11 +03:00
1 parent 6c6c9f91ca
commit 01acda1e04
8 files changed
+478 -217

No files matched your search

+3 -2
View File
@@ -47,7 +47,7 @@ const Index: NextPage<Props> = props => (
</App>
)
export const unstable_getStaticProps = async (ctx: any) => {
export const getStaticProps = async (ctx: any) => {
let slug = null
if (ctx.query) {
slug = '/' + array(ctx.query.slug).join('/')
@@ -79,13 +79,14 @@ export const unstable_getStaticProps = async (ctx: any) => {
}
}
export const unstable_getStaticPaths = async () => {
export const getStaticPaths = async () => {
const urls = await requestGet<IResponseItems<string>>(createApiUrl(`/api/pages/urls`), null)
if (!urls) {
return null
}
return {
fallback: true,
paths: urls.items
.map(path => {
const slug = tail(path.split('/'))
+1 -1
View File
@@ -101,7 +101,7 @@ const Page: NextPage<Props> = props => {
)
}
export const unstable_getStaticProps = async (ctx: NextPageContext) => {
export const getStaticProps = async (ctx: NextPageContext) => {
const title = 'Преподаватели Шлиссельбургской ДХШ'
const pages = await Promise.all(persons
.map(page => requestGet<IPage>(createApiUrl(`/api/page?page=${page}`), null))
+32 -22
View File
@@ -6,37 +6,47 @@ import { HudozkaTitle } from 'src/components/HudozkaTitle'
import { MetaBuilder } from 'src/lib/meta'
import { getPagesCardsByTags } from 'src/rest'
import { NextPage } from 'next'
import { IMeta, PageCardData } from 'src/types'
import { IMeta, PageCardData, PageCardDto } from 'src/types'
interface IProps {
title: string
meta: IMeta
items: PageCardData[]
items: PageCardDto[]
}
const Index: NextPage<IProps> = props => (
<App
showAuthor={true}
wide={true}
>
<Head>
<title>{props.title}</title>
<Meta meta={props.meta} />
</Head>
const Index: NextPage<IProps> = props => {
const items = props.items.map<PageCardData>(item => ({
url: item.url,
title: item.title,
featured: item.featured,
date: new Date(item.date),
coverSrc: item.coverSrc,
}))
<HudozkaTitle
style={{
marginBottom: 'var(--size-l)'
}}
/>
return (
<App
showAuthor={true}
wide={true}
>
<Head>
<title>{props.title}</title>
<Meta meta={props.meta} />
</Head>
<PageGrid
items={props.items}
/>
</App>
)
<HudozkaTitle
style={{
marginBottom: 'var(--size-l)'
}}
/>
export const unstable_getStaticProps = async () => {
<PageGrid
items={items}
/>
</App>
)
}
export const getStaticProps = async () => {
const items = await getPagesCardsByTags([
'event',
'album',