good forst commit

This commit is contained in:
2026-06-09 02:02:40 +05:30
parent 801c1d7121
commit 249d759e6a
215 changed files with 15425 additions and 1240 deletions
+28
View File
@@ -0,0 +1,28 @@
import { apiFetch, jsonResponse } from '../../../_lib/api';
export const dynamic = 'force-dynamic';
export async function PUT(
req: Request,
{ params }: { params: Promise<{ id: string }> },
): Promise<Response> {
const { id } = await params;
const body = await req.json();
const res = await apiFetch(`/admin/rules/${id}`, {
method: 'PUT',
body: JSON.stringify(body),
});
const payload = await res.json();
return jsonResponse(payload, res.status);
}
export async function DELETE(
_req: Request,
{ params }: { params: Promise<{ id: string }> },
): Promise<Response> {
const { id } = await params;
const res = await apiFetch(`/admin/rules/${id}`, { method: 'DELETE' });
if (res.status === 204) return new Response(null, { status: 204 });
const body = await res.text();
return new Response(body, { status: res.status, headers: { 'Content-Type': 'application/json' } });
}
+19
View File
@@ -0,0 +1,19 @@
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);
}