feat(ecommerce): migrate Ari Shopping to Next.js 15 headless storefront v4
Build and Push Frontend / build (push) Failing after 5m39s
Build and Push Frontend / build (push) Failing after 5m39s
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import type { CatalogProvider, ProductFilters } from "@/lib/headless/types";
|
||||
import { medusaCatalogProvider } from "@/lib/headless/providers/medusa";
|
||||
import { mockCatalogProvider } from "@/lib/headless/providers/mock";
|
||||
import { shopifyCatalogProvider } from "@/lib/headless/providers/shopify";
|
||||
|
||||
function provider(): CatalogProvider {
|
||||
switch (process.env.HEADLESS_PROVIDER) {
|
||||
case "shopify": return shopifyCatalogProvider;
|
||||
case "medusa": return medusaCatalogProvider;
|
||||
default: return mockCatalogProvider;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getProducts(filters?: ProductFilters) {
|
||||
return provider().getProducts(filters);
|
||||
}
|
||||
|
||||
export async function getProductBySlug(slug: string) {
|
||||
return provider().getProductBySlug(slug);
|
||||
}
|
||||
|
||||
export async function searchProducts(query: string, limit?: number) {
|
||||
return provider().searchProducts(query, limit);
|
||||
}
|
||||
Reference in New Issue
Block a user