⚙️ Trying to fix copy react code

This commit is contained in:
pheralb
2025-07-14 12:07:55 +01:00
parent 958a7b9725
commit dc8dffc5c9
+1 -19
View File
@@ -13,21 +13,6 @@ export const GET = async () => {
}; };
export const POST = async ({ request }: RequestEvent) => { export const POST = async ({ request }: RequestEvent) => {
const ip = request.headers.get('x-forwarded-for') ?? '';
const { success, reset } = await ratelimit.limit(ip);
// Error 429 | If rate limit is exceeded:
if (!success) {
const now = Date.now();
const retryAfter = Math.floor((reset - now) / 500);
return new Response('Too Many Requests', {
status: 429,
headers: {
'Retry-After': retryAfter.toString()
}
});
}
try { try {
const body = await request.json(); const body = await request.json();
@@ -47,9 +32,6 @@ export const POST = async ({ request }: RequestEvent) => {
return json({ data: jsCode }, { status: 200 }); return json({ data: jsCode }, { status: 200 });
} catch (error) { } catch (error) {
return json( return json({ error: `⚠️ api/svgs/svgr - Error: ${error}` }, { status: 500 });
{ error: `Error al transformar el SVG a componente React: ${error}` },
{ status: 500 }
);
} }
}; };