17 lines
514 B
JavaScript
17 lines
514 B
JavaScript
import { NextResponse } from 'next/server';
|
|
import { requireAdminAuth } from '@/lib/adminAuth';
|
|
import { engineFetch } from '@/lib/engine';
|
|
|
|
export async function PATCH(req, { params }) {
|
|
await requireAdminAuth();
|
|
try {
|
|
const body = await req.json();
|
|
const data = await engineFetch(`/api/drafts/${params.id}`, {
|
|
method: 'PATCH', body: JSON.stringify(body),
|
|
});
|
|
return NextResponse.json(data);
|
|
} catch (err) {
|
|
return NextResponse.json({ error: err.message }, { status: 500 });
|
|
}
|
|
}
|