12 lines
637 B
JavaScript
12 lines
637 B
JavaScript
import { NextResponse } from 'next/server';
|
|
import { checkAdminAuth } from '@/lib/adminAuth';
|
|
const E = process.env.ENGINE_URL||'http://127.0.0.1:3030';
|
|
const S = process.env.ENGINE_SECRET||'zeropost_internal_2026';
|
|
const h = { 'Content-Type':'application/json','x-internal-secret':S };
|
|
export async function PATCH(req) {
|
|
if (!(await checkAdminAuth())) return NextResponse.json({error:'Unauthorized'},{status:401});
|
|
const { category, ...data } = await req.json();
|
|
const res = await fetch(`${E}/api/autogen/settings/${category}`,{method:'PATCH',headers:h,body:JSON.stringify(data)});
|
|
return NextResponse.json(await res.json());
|
|
}
|