- Update background colors and text styles for better contrast and legibility. - Enhance button styles and hover effects for a more modern look. - Remove unnecessary scaling effects and adjust border styles for consistency. - Introduce a cohesive design language across components to improve user experience.
26 lines
745 B
TypeScript
26 lines
745 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { prisma } from '@/lib/prisma';
|
|
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
// In a real app, you would check for admin session here
|
|
// For now, we trust the 'x-admin-request' header if it's set by the server-side component or middleware
|
|
// but typically you'd verify the session cookie/token
|
|
|
|
const contacts = await prisma.contact.findMany({
|
|
orderBy: {
|
|
createdAt: 'desc',
|
|
},
|
|
take: 100,
|
|
});
|
|
|
|
return NextResponse.json({ contacts });
|
|
} catch (error) {
|
|
console.error('Error fetching contacts:', error);
|
|
return NextResponse.json(
|
|
{ error: 'Failed to fetch contacts' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|