Files
InaTrading-Portal/src/app/api/admin/places/[placeId]/route.ts
2026-04-24 05:19:05 +07:00

28 lines
872 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { API_URL, makeHeaders } from "@/lib/api";
export async function GET(
_req: NextRequest,
_context: { params: Promise<{ placeId: string }> }
) {
return NextResponse.json({ responseDesc: "Not supported" }, { status: 404 });
}
export async function PUT(
req: NextRequest,
context: { params: Promise<{ placeId: string }> }
) {
const token = req.headers.get("x-auth-token") || "";
const { placeId } = await context.params;
const body = await req.json();
// Postman collection shows Update Location uses /addresses/{id}
const res = await fetch(`${API_URL}/api/v1.0/addresses/${placeId}`, {
method: "PUT",
headers: makeHeaders(token),
body: JSON.stringify(body),
});
const data = await res.json().catch(() => ({}));
return NextResponse.json(data, { status: res.status });
}