mirror of
https://github.com/vercel/commerce.git
synced 2025-07-25 11:11:24 +00:00
task: prettier
This commit is contained in:
@@ -2,24 +2,18 @@ import { CollectionCountableEdge } from '../schema'
|
||||
import { getConfig, SaleorConfig } from '../api'
|
||||
import * as query from '../utils/queries'
|
||||
|
||||
const getAllCollections = async (options?: {
|
||||
variables?: any
|
||||
config: SaleorConfig
|
||||
preview?: boolean
|
||||
}) => {
|
||||
const getAllCollections = async (options?: { variables?: any; config: SaleorConfig; preview?: boolean }) => {
|
||||
let { config, variables = { first: 100 } } = options ?? {}
|
||||
config = getConfig(config)
|
||||
|
||||
const { data } = await config.fetch(query.CollectionMany, { variables })
|
||||
const edges = data.collections?.edges ?? []
|
||||
|
||||
const categories = edges.map(
|
||||
({ node: { id: entityId, name, slug } }: CollectionCountableEdge) => ({
|
||||
entityId,
|
||||
name,
|
||||
path: `/${slug}`,
|
||||
})
|
||||
)
|
||||
const categories = edges.map(({ node: { id: entityId, name, slug } }: CollectionCountableEdge) => ({
|
||||
entityId,
|
||||
name,
|
||||
path: `/${slug}`,
|
||||
}))
|
||||
|
||||
return {
|
||||
categories,
|
||||
|
Reference in New Issue
Block a user