task: prettier

This commit is contained in:
Zaiste
2021-05-18 14:20:07 +02:00
parent bf68f6aff7
commit 4a652a9b6a
56 changed files with 635 additions and 1480 deletions

View File

@@ -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,