15 lines
335 B
TypeScript
15 lines
335 B
TypeScript
import { Product } from "@/lib/products";
|
|
|
|
export async function getAllProducts(): Promise<Product[]> {
|
|
const res = await fetch("https://admin.promtechno.uz/api/products/", {
|
|
cache: "force-cache", // build time uchun
|
|
});
|
|
|
|
if (!res.ok) {
|
|
console.log("Failed to fetch products");
|
|
return [];
|
|
}
|
|
|
|
return res.json();
|
|
}
|