17 lines
719 B
TypeScript
17 lines
719 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { getImageProject, updateImageProject } from "../../../../lib/image-projects";
|
|
import { errorResponse } from "../../../../lib/http";
|
|
|
|
export const runtime = "nodejs";
|
|
type Context = { params: Promise<{ id: string }> };
|
|
|
|
export async function GET(_: Request, context: Context) {
|
|
try { return NextResponse.json({ project: await getImageProject((await context.params).id) }); }
|
|
catch (error) { return errorResponse(error); }
|
|
}
|
|
|
|
export async function PUT(request: Request, context: Context) {
|
|
try { return NextResponse.json({ project: await updateImageProject((await context.params).id, await request.json()) }); }
|
|
catch (error) { return errorResponse(error); }
|
|
}
|