fix api requests

This commit is contained in:
tmshv committed 2020-02-21 22:23:09 +03:00
1 parent 114bb8d9d4
commit a28f7ccd84
2 files changed
+2 -4

No files matched your search

-4
View File
@@ -53,10 +53,6 @@ export const unstable_getStaticProps = async () => {
const pageSize = process.env.APP_ARTICLES_PAGE_SIZE
const res = await requestGet<IResponseItems<IArticle>>(createApiUrl(`/api/articles?page=${page}&pageSize=${pageSize}`), null)
const articles = (res.items || [])
.map(x => ({
...x,
featured: x.id === '2019-kotiki'
}))
const nextPage = res.nextPage
const prevPage = res.prevPage
const title = 'Шлиссельбургская ДХШ'
+2
View File
@@ -3,6 +3,8 @@ import { NextPageContext } from 'next'
export interface IResponseItems<T> {
items: T[]
nextPage: number
prevPage: number
}
export async function requestGet<T>(url: string, defaultResponse: T): Promise<T> {