Files
klarbild/src/pages/api/admin/test-nas.ts
T

13 lines
496 B
TypeScript

import type { APIRoute } from 'astro';
import { loadNasConfig, testNas } from '../../../lib/nas';
export const prerender = false;
const json = (b: unknown, s = 200) =>
new Response(JSON.stringify(b), { status: s, headers: { 'Content-Type': 'application/json' } });
export const POST: APIRoute = async () => {
const cfg = await loadNasConfig();
if (!cfg) return json({ ok: false, message: 'NAS nicht vollständig konfiguriert (oder deaktiviert).' });
return json(await testNas(cfg));
};