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
@@ -2,7 +2,7 @@
import { formatCurrency } from '$lib/utils/currency';
export let imgAlt = '';
export let imgSrc = '';
// export let itemCategoryDescription = '';
export let itemCategoryDescription = '';
export let itemName = '';
export let price = 0;
export let quantity = 0;
@@ -20,11 +20,11 @@
<h5 class="font-semibold text-xl leading-8 text-black max-[550px]:text-center">
{itemName}
</h5>
<!-- <p
<p
class="font-normal text-lg leading-8 text-gray-500 my-2 min-[550px]:my-3 max-[550px]:text-center"
>
{itemCategoryDescription}
</p> -->
</p>
<div class="flex items-center">
<h6
+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
};