initial commit

This commit is contained in:
2026-04-17 17:06:55 +07:00
parent fab77ed970
commit 6404495696
28 changed files with 9704 additions and 224 deletions
+44
View File
@@ -0,0 +1,44 @@
export interface Post {
id: number;
title: string;
description: string;
cover?: string;
slug: string;
publishedAt: string;
}
const STRAPI_URL =
process.env.NEXT_PUBLIC_STRAPI_API_URL || "http://localhost:1337";
export async function fetchPosts(): Promise<Post[]> {
try {
// Пример запроса. Раскомментируйте, когда Strapi будет запущен
// const res = await fetch(`${STRAPI_URL}/api/posts?populate=*`, {
// next: { revalidate: 3600 }
// });
// if (!res.ok) throw new Error("Failed to fetch posts");
// const data = await res.json();
// return data.data;
// Моковые данные для разработки:
return [
{
id: 1,
title: "Netrunner Protocol V2: What's New?",
description: "Explore the next generation of zero-knowledge routing.",
slug: "netrunner-v2",
publishedAt: new Date().toISOString(),
},
{
id: 2,
title: "Why Military-Grade Encryption Matters",
description: "How AES-256 and ChaCha20 secure your digital footprint.",
slug: "encryption-matters",
publishedAt: new Date().toISOString(),
},
];
} catch (error) {
console.error("Strapi fetch error:", error);
return [];
}
}