22 lines
579 B
TypeScript
22 lines
579 B
TypeScript
import { db } from "@/lib/db"
|
|
import { NextResponse } from "next/server";
|
|
|
|
export async function GET(req: Request, { params } : { params: { id: string } }) {
|
|
try {
|
|
let id = req.headers.get('x-api-key')
|
|
if (id == null) {
|
|
return NextResponse.json(null);
|
|
}
|
|
|
|
const tokens = await db.apiKey.findFirst({
|
|
where: {
|
|
id: id as string
|
|
}
|
|
});
|
|
|
|
return NextResponse.json(tokens);
|
|
} catch (error) {
|
|
console.log("[VALIDATE/GET]", error);
|
|
return new NextResponse("Internal Error", { status: 500});
|
|
}
|
|
} |