wip
This commit is contained in:
@@ -73,6 +73,13 @@ export async function getAllProductSlugs(locale: string): Promise<string[]> {
|
||||
|
||||
export async function getAllProducts(locale: string): Promise<ProductMdx[]> {
|
||||
const slugs = await getAllProductSlugs(locale);
|
||||
const products = await Promise.all(slugs.map(slug => getProductBySlug(slug, locale)));
|
||||
let allSlugs = slugs;
|
||||
|
||||
if (locale !== 'en') {
|
||||
const enSlugs = await getAllProductSlugs('en');
|
||||
allSlugs = Array.from(new Set([...slugs, ...enSlugs]));
|
||||
}
|
||||
|
||||
const products = await Promise.all(allSlugs.map(slug => getProductBySlug(slug, locale)));
|
||||
return products.filter((p): p is ProductMdx => p !== null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user