handle empty cart, variants, options, errors

This commit is contained in:
Greg Hoskin
2021-04-30 18:35:19 -05:00
parent b83753f0b9
commit ffbcce2a9e
8 changed files with 33 additions and 75 deletions

View File

@@ -1,7 +1,5 @@
import { Product } from '@commerce/types'
import { getConfig, SwellConfig } from '../api'
import fetchAllProducts from '../api/utils/fetch-all-products'
import { ProductEdge } from '../schema'
type ProductPath = {
path: string
@@ -20,7 +18,7 @@ const getAllProductPaths = async (options?: {
config?: SwellConfig
preview?: boolean
}): Promise<ReturnType> => {
let { config, variables = { limit: 100 } } = options ?? {}
let { config, variables = [{ limit: 100 }] } = options ?? {}
config = getConfig(config)
const products = await fetchAllProducts({