Files
rk-frontend/src/app/sensoren-analog/export/route.ts
T
2026-12-04 10:14:49 +01:00

24 lines
795 B
TypeScript

import { BACKEND_URL } from '@/_config/backend';
const EXCEL_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
export async function GET() {
try {
const response = await fetch(`${BACKEND_URL}/rk2/sensoren-analog/export`, { cache: 'no-store' });
if (!response.ok) {
return new Response('Sensoren-Export fehlgeschlagen', { status: 502 });
}
return new Response(response.body, {
headers: {
'Content-Type': EXCEL_CONTENT_TYPE,
'Content-Disposition': 'attachment; filename="Sensoren_Analog.xlsx"',
'Cache-Control': 'no-store',
},
});
} catch {
return new Response('Keine Verbindung zum Backend', { status: 502 });
}
}