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

@@ -1,5 +1,5 @@
import { SwellProduct } from '@framework/types'
import { getConfig, SwellConfig } from '../api'
import fetchAllProducts from '../api/utils/fetch-all-products'
type ProductPath = {
path: string
@@ -21,15 +21,14 @@ const getAllProductPaths = async (options?: {
let { config, variables = [{ limit: 100 }] } = options ?? {}
config = getConfig(config)
const products = await fetchAllProducts({
config,
query: 'products',
method: 'list',
variables,
})
const { results } = await config.fetch('products', 'list', [
{
limit: variables.first,
},
])
return {
products: products?.map(({ slug: handle }) => ({
products: results?.map(({ slug: handle }: SwellProduct) => ({
node: {
path: `/${handle}`,
},