28 lines
872 B
TypeScript
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 });
|
|
}
|