feat(#11): Add the description and fetching the images from Stripe on checkout success page

This commit is contained in:
Josh Creek
2024-10-22 18:40:32 +01:00
parent 7e458b7297
commit 7825d29081
4 changed files with 38 additions and 12 deletions
+16 -1
View File
@@ -441,6 +441,20 @@ const getActiveProductsWithPrices = async (limit = 10, offset = 0) => {
return { products: products as ProductWithPrices[], count };
};
const getProductById = async (productId: string) => {
const { data: product, error } = await supabaseAdmin
.from('products')
.select('*')
.eq('id', productId)
.single();
if (error) {
throw new Error(`Error fetching product: ${error.message}`);
}
return product as Product;
};
export {
upsertProductRecord,
upsertPriceRecord,
@@ -453,5 +467,6 @@ export {
addCredits,
deductCredits,
getUserCredits,
getActiveProductsWithPrices
getActiveProductsWithPrices,
getProductById
};