mirror of
https://github.com/arthur-pbty/links.git
synced 2026-08-01 20:29:27 +02:00
15 lines
401 B
JavaScript
15 lines
401 B
JavaScript
import { NextResponse } from 'next/server';
|
|
import { incrementClick } from '../../../../lib/storage';
|
|
|
|
export async function POST(request) {
|
|
const body = await request.json().catch(() => ({}));
|
|
const linkId = body.linkId;
|
|
|
|
if (!linkId) {
|
|
return NextResponse.json({ error: 'linkId requis.' }, { status: 400 });
|
|
}
|
|
|
|
await incrementClick(linkId);
|
|
return NextResponse.json({ ok: true });
|
|
}
|