good forst commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { apiFetch, jsonResponse } from '../../../../_lib/api';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function POST(
|
||||
_req: Request,
|
||||
{ params }: { params: Promise<{ id: string }> },
|
||||
): Promise<Response> {
|
||||
const { id } = await params;
|
||||
const res = await apiFetch(`/admin/messages/${id}/approve`, { method: 'POST' });
|
||||
const body = await res.text();
|
||||
let payload: unknown = body;
|
||||
try {
|
||||
payload = JSON.parse(body);
|
||||
} catch {
|
||||
/* keep as text */
|
||||
}
|
||||
return jsonResponse(payload, res.status);
|
||||
}
|
||||
Reference in New Issue
Block a user