SPB Git

Repository Public

route.ts 794 B 20 lines typescript

1// Auteur : Simon-Pierre Boucher — contact@spboucher.ai2// Mon KA — export des données personnelles (Loi 25) : JSON téléchargeable3// (profil, favoris, recherches, alertes, préférences apprises, journal).4import { NextResponse } from "next/server";5import { getSessionUser } from "@/lib/auth";6import { exportUserData } from "@/lib/kaid-data";78export async function GET() {9  const user = await getSessionUser();10  if (!user)11    return NextResponse.json({ error: "non connecté" }, { status: 401 });12  const data = exportUserData(user.id);13  return new NextResponse(JSON.stringify(data, null, 2), {14    headers: {15      "Content-Type": "application/json; charset=utf-8",16      "Content-Disposition": `attachment; filename="ka-id-export-${user.kaId ?? user.id}.json"`,17    },18  });19}20
Files main
Menu

Theme