22 lines
650 B
TypeScript
22 lines
650 B
TypeScript
|
|
import { NextRequest, NextResponse } from "next/server";
|
||
|
|
import { pushCardToMonday } from "@/lib/integrations";
|
||
|
|
|
||
|
|
export async function POST(
|
||
|
|
_request: NextRequest,
|
||
|
|
{ params }: { params: Promise<{ id: string }> }
|
||
|
|
) {
|
||
|
|
try {
|
||
|
|
const { id } = await params;
|
||
|
|
const result = await pushCardToMonday(id);
|
||
|
|
return NextResponse.json({
|
||
|
|
ok: true,
|
||
|
|
action: result.action,
|
||
|
|
mondayItemId: result.mondayItemId,
|
||
|
|
});
|
||
|
|
} catch (error) {
|
||
|
|
console.error("[monday/push POST]", error);
|
||
|
|
const message = error instanceof Error ? error.message : "Push failed";
|
||
|
|
return NextResponse.json({ error: message }, { status: 500 });
|
||
|
|
}
|
||
|
|
}
|