mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 15:36:58 +00:00
- Extended motlin sdk and corrected pcm ur - Using new client for below sections - Get all products - Get product - Get all products path - Login & Signup - Customers - Changing product normalizer for pcm products
24 lines
623 B
TypeScript
24 lines
623 B
TypeScript
import data from '../../data.json'
|
|
import normalizeProduct from '../../utils/normalize'
|
|
import epClient from '../../utils/ep-client'
|
|
|
|
|
|
export type GetAllProductPathsResult = {
|
|
products: Array<{ path: string }>
|
|
}
|
|
|
|
export default function getAllProductPathsOperation() {
|
|
async function getAllProductPaths(): Promise<GetAllProductPathsResult> {
|
|
let products = await epClient.PCM.Limit(200).All();
|
|
let paths = [];
|
|
for (let product of products.data) {
|
|
paths.push({path: "/"+product.attributes.slug});
|
|
}
|
|
return await Promise.resolve({
|
|
products: paths
|
|
})
|
|
}
|
|
|
|
return getAllProductPaths
|
|
}
|