mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
handle empty cart, variants, options, errors
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
import Client from 'shopify-buy'
|
||||
import { SwellConfig } from '../index'
|
||||
|
||||
type Options = {
|
||||
config: SwellConfig
|
||||
}
|
||||
|
||||
const getAllCollections = async (options: Options) => {
|
||||
const { config } = options
|
||||
|
||||
const client = Client.buildClient({
|
||||
storefrontAccessToken: config.apiToken,
|
||||
domain: config.commerceUrl,
|
||||
})
|
||||
|
||||
const res = await client.collection.fetchAllWithProducts()
|
||||
|
||||
return JSON.parse(JSON.stringify(res))
|
||||
}
|
||||
|
||||
export default getAllCollections
|
Reference in New Issue
Block a user