This commit is contained in:
@@ -2,13 +2,24 @@ import React from 'react';
|
||||
import Link from 'next/link';
|
||||
import { ArrowRight } from 'lucide-react';
|
||||
import { prisma } from '../../lib/prisma';
|
||||
import { MOCK_BLOG_POSTS } from '../../lib/mockData';
|
||||
|
||||
export const revalidate = 3600; // Revalidate every hour
|
||||
|
||||
export default async function BlogPage() {
|
||||
const posts = await prisma.blogPost.findMany({
|
||||
orderBy: { createdAt: 'desc' }
|
||||
});
|
||||
let posts: any[] = [];
|
||||
|
||||
try {
|
||||
posts = await prisma.blogPost.findMany({
|
||||
orderBy: { createdAt: 'desc' }
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Database connection failed on blog page, using mock data.");
|
||||
posts = MOCK_BLOG_POSTS.map(p => ({
|
||||
...p,
|
||||
createdAt: new Date(p.date), // Map mock date to createdAt to satisfy frontend
|
||||
}));
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
|
||||
|
||||
Reference in New Issue
Block a user