good forst commit
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
const API_URL = process.env.API_URL ?? 'http://localhost:3001';
|
||||
import { apiFetch } from '../../../_lib/api';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function DELETE(
|
||||
_req: Request,
|
||||
{ params }: { params: Promise<{ id: string }> },
|
||||
) {
|
||||
): Promise<Response> {
|
||||
const { id } = await params;
|
||||
const res = await fetch(`${API_URL}/routes/${id}`, { method: 'DELETE' });
|
||||
const res = await apiFetch(`/routes/${id}`, { method: 'DELETE' });
|
||||
if (res.status === 204) return new Response(null, { status: 204 });
|
||||
return Response.json(await res.json(), { status: res.status });
|
||||
const body = await res.text();
|
||||
return new Response(body, { status: res.status, headers: { 'Content-Type': 'application/json' } });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user