cdrdpyj/src/pages/api/voluntarios/count.ts

22 lines
569 B
TypeScript

import type { APIRoute } from "astro";
import { getVolunteerCount } from "../lib/googleSheets";
export const prerender = false;
export const GET: APIRoute = async () => {
try {
const count = await getVolunteerCount();
return Response.json(
{ success: true, count },
{ headers: { "Cache-Control": "no-store" } }
);
} catch (error) {
console.error("Error en /api/voluntarios/count:", error);
return Response.json(
{ success: false, message: "Error al obtener el contador de voluntarios" },
{ status: 500 }
);
}
};