mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Fix build errors
This commit is contained in:
@@ -9,7 +9,7 @@ const getAllCollections = async (options?: {
|
||||
let { config, variables = { limit: 25 } } = options ?? {}
|
||||
config = getConfig(config)
|
||||
|
||||
const response = await config.fetchSwell('categories', 'list', { variables })
|
||||
const response = await config.fetch('categories', 'list', { variables })
|
||||
const edges = response.results ?? []
|
||||
|
||||
const categories = edges.map(
|
||||
|
@@ -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}`,
|
||||
},
|
||||
|
@@ -19,7 +19,7 @@ const getAllProducts = async (options: {
|
||||
}): Promise<ReturnType> => {
|
||||
let { config, variables = { first: 250 } } = options ?? {}
|
||||
config = getConfig(config)
|
||||
const { results } = await config.fetchSwell('products', 'list', [
|
||||
const { results } = await config.fetch('products', 'list', [
|
||||
{
|
||||
limit: variables.first,
|
||||
},
|
||||
|
@@ -18,10 +18,12 @@ const getProduct = async (options: {
|
||||
let { config, variables } = options ?? {}
|
||||
config = getConfig(config)
|
||||
|
||||
const product = await config.fetchSwell('products', 'get', [variables.slug])
|
||||
const product = await config.fetch('products', 'get', [variables.slug])
|
||||
|
||||
if (product && product.variants) {
|
||||
product.variants = product.variants?.results
|
||||
}
|
||||
|
||||
return {
|
||||
product: product ? normalizeProduct(product) : null,
|
||||
}
|
||||
|
Reference in New Issue
Block a user