Beginning of ecommerce

This commit is contained in:
2024-09-26 09:50:24 +05:30
parent e4925eeb16
commit a5398565cf
25 changed files with 493 additions and 34 deletions

View File

@ -0,0 +1,16 @@
import { cache } from 'react';
import { medusaClient } from '@/lib/config';
import { PricedProduct } from '@medusajs/medusa/dist/types/pricing';
export const getProductByHandle = cache(async function (
handle: string,
): Promise<{ product: PricedProduct }> {
const product = await medusaClient.products
.list({ handle })
.then(({ products }) => products[0])
.catch((err) => {
throw err;
});
return { product };
});