mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
cleanup
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
import { CollectionEdge } from '../../schema'
|
||||
import { getConfig, SwellConfig } from '..'
|
||||
|
||||
const getAllCollections = async (options?: {
|
||||
variables?: any
|
||||
config: SwellConfig
|
||||
preview?: boolean
|
||||
}) => {
|
||||
let { config, variables = { limit: 25 } } = options ?? {}
|
||||
config = getConfig(config)
|
||||
|
||||
const response = await config.fetch('categories', 'list', { variables })
|
||||
const edges = response.results ?? []
|
||||
|
||||
const categories = edges.map(
|
||||
({ node: { id: entityId, title: name, handle } }: CollectionEdge) => ({
|
||||
entityId,
|
||||
name,
|
||||
path: `/${handle}`,
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
categories,
|
||||
}
|
||||
}
|
||||
|
||||
export default getAllCollections
|
Reference in New Issue
Block a user