import { FaqBackendItem } from "@/components/FAQ";
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 for gitea
  });

  if (!res.ok) {
    console.log("Failed to fetch products");
    return [];
  }

  return res.json();
}

export async function getAllFaq(): Promise<FaqBackendItem[]> {
  const res = await fetch("https://admin.promtechno.uz/api/faqs/");

  if (!res.ok) {
    console.log("Failed to fetch faqs");
    return [];
  }

  return res.json();
}
