mirror of
https://github.com/arthur-pbty/links.git
synced 2026-08-01 20:29:27 +02:00
13 lines
405 B
JavaScript
13 lines
405 B
JavaScript
import { NextResponse } from 'next/server';
|
|
import { getAnalyticsForLinks } from '../../../lib/storage';
|
|
import { isAdminRequest } from '../../../lib/auth';
|
|
|
|
export async function GET(request) {
|
|
if (!isAdminRequest(request)) {
|
|
return NextResponse.json({ error: 'Non autorisé.' }, { status: 401 });
|
|
}
|
|
|
|
const analytics = await getAnalyticsForLinks();
|
|
return NextResponse.json({ analytics });
|
|
}
|