Fix: Invalid query in slug route and NewsCard footer logic
This commit is contained in:
parent
8e27335f71
commit
c76ed914b1
@ -6,6 +6,8 @@ import { Calendar, User, ArrowLeft } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
|
||||
async function fetchPostData(slugOrId: string) {
|
||||
if (!slugOrId || typeof slugOrId !== 'string' || slugOrId.includes('.')) return null;
|
||||
|
||||
try {
|
||||
const client = await createAdminClient();
|
||||
const dbId = APPWRITE_ALMEIRA_CONFIG.databaseId;
|
||||
@ -25,7 +27,10 @@ async function fetchPostData(slugOrId: string) {
|
||||
return null;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Post detail fetch error", e);
|
||||
// En desarrollo o por favicon.ico etc, esto puede fallar. Solo logueamos si es error real.
|
||||
if (!slugOrId.includes('favicon')) {
|
||||
console.error("Post detail fetch error for slug:", slugOrId, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,8 +24,8 @@ export const NewsCard = ({
|
||||
fecha,
|
||||
imagenUrl,
|
||||
showCategory = false,
|
||||
showFooterDate = true,
|
||||
showFooterButton = true,
|
||||
showFooterDate = false,
|
||||
showFooterButton = false,
|
||||
footerText
|
||||
}: NewsCardProps) => {
|
||||
// Formatear fecha
|
||||
@ -74,10 +74,10 @@ export const NewsCard = ({
|
||||
{fechaFormateada}
|
||||
</div>
|
||||
) : (
|
||||
footerText || "Ver más"
|
||||
footerText || ""
|
||||
)}
|
||||
</span>
|
||||
{showFooterButton && (
|
||||
{showFooterButton && footerText && (
|
||||
<div className="w-8 h-8 rounded-full bg-white/5 flex items-center justify-center border border-white/10 group-hover:bg-cyan-500 group-hover:border-cyan-400 group-hover:text-slate-950 transition-all">
|
||||
<ArrowUpRight size={16} className="transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5" />
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user