ceo optimization
This commit is contained in:
14
lib/api.ts
Normal file
14
lib/api.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user