1
0
mirror of https://github.com/vercel/commerce.git synced 2025-03-28 08:15:54 +00:00
ghoskin 4d85b43a30
Update Swell Provider ()
* fix update cart item

* update types

* update checkout

* update get-page, cleanup types

* revert change to incorrect file

* cleanup

Co-authored-by: Greg Hoskin <greghoskin@Gregs-MacBook-Pro.local>
2021-06-14 17:37:18 -03:00

17 lines
382 B
TypeScript

import { SwellConfig } from '../api'
import { Category } from '../types/site'
const getCategories = async (config: SwellConfig): Promise<Category[]> => {
const data = await config.fetch('categories', 'get')
return (
data.results.map(({ id, name, slug }: any) => ({
id,
name,
slug,
path: `/${slug}`,
})) ?? []
)
}
export default getCategories