fix/saleor: display the custom categories

This commit is contained in:
Zaiste 2021-06-10 21:40:40 +02:00
parent 4492f3051c
commit 2c8673c15a
No known key found for this signature in database
GPG Key ID: 15DF7EBC7F2FFE35

View File

@ -10,14 +10,18 @@ const getCategories = async (config: SaleorConfig): Promise<Category[]> => {
},
})
return (
const categories =
data.collections?.edges?.map(({ node: { id, name, slug } }: CollectionCountableEdge) => ({
id,
name,
slug,
path: `/${slug}`,
})) ?? []
)
// FIXME temp hack
const result = categories.sort((a: any, b: any) => a.name.localeCompare(b.name))
return result
}
export default getCategories