Fix build errors

This commit is contained in:
cond0r
2021-05-13 16:10:09 +03:00
parent e7d0f56e85
commit bff94e73ae
22 changed files with 87 additions and 458 deletions

View File

@@ -23,12 +23,13 @@ const getAllPages = async (options?: {
}): Promise<ReturnType> => {
let { config, variables = { first: 250 } } = options ?? {}
config = getConfig(config)
const { locale, fetchSwell } = config
const { results } = await fetchSwell('content', 'list', ['pages'])
const pages = results.map(({ slug, ...rest }: { slug: string }) => ({
url: `/${locale}/${slug}`,
...rest,
}))
const { locale, fetch } = config
const data = await fetch('content', 'list', ['pages'])
const pages =
data?.results?.map(({ slug, ...rest }: { slug: string }) => ({
url: `/${locale}/${slug}`,
...rest,
})) ?? []
return { pages }
}

View File

@@ -17,7 +17,7 @@ const getPage = async (options: {
config = getConfig(config)
const { locale } = config
const { id } = variables
const result = await config.fetchSwell('content', 'get', ['pages', id])
const result = await config.fetch('content', 'get', ['pages', id])
const page = result
return {