20 lines
553 B
TypeScript
20 lines
553 B
TypeScript
import { apiFetch, jsonResponse } from '../../_lib/api';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
export async function GET(): Promise<Response> {
|
|
const res = await apiFetch('/admin/rules');
|
|
const body = await res.json();
|
|
return jsonResponse(body, res.status);
|
|
}
|
|
|
|
export async function POST(req: Request): Promise<Response> {
|
|
const body = await req.json();
|
|
const res = await apiFetch('/admin/rules', {
|
|
method: 'POST',
|
|
body: JSON.stringify(body),
|
|
});
|
|
const payload = await res.json();
|
|
return jsonResponse(payload, res.status);
|
|
}
|