mirror of
https://github.com/vercel/commerce.git
synced 2025-03-28 00:05:53 +00:00
* 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>
17 lines
382 B
TypeScript
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
|