mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-13 02:53:50 +00:00
refactor(*): Cast instead of declaring a new const
This commit is contained in:
@@ -430,9 +430,7 @@ const getActiveProductsWithPrices = async (limit = 10, offset = 0) => {
|
|||||||
throw new Error(`Error fetching products: ${error.message}`);
|
throw new Error(`Error fetching products: ${error.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const typedProducts: ProductWithPrices[] = products;
|
for (const product of products as ProductWithPrices[]) {
|
||||||
|
|
||||||
for (const product of typedProducts) {
|
|
||||||
if (product.prices && product.prices.length > 0) {
|
if (product.prices && product.prices.length > 0) {
|
||||||
// Assuming the default price is the first one
|
// Assuming the default price is the first one
|
||||||
const defaultPrice = product.prices[0];
|
const defaultPrice = product.prices[0];
|
||||||
@@ -440,7 +438,7 @@ const getActiveProductsWithPrices = async (limit = 10, offset = 0) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { products: typedProducts, count }; // Return products and total count
|
return { products, count }; // Return products and total count
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|||||||
Reference in New Issue
Block a user