Initial ASPHP website
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { getCurrentUser } from "../../meshkee";
|
||||
|
||||
export async function GET(request) {
|
||||
const token = request.headers.get("authorization")?.replace(/^Bearer\s+/i, "");
|
||||
if (!token) return NextResponse.json({ message: "Missing token" }, { status: 401 });
|
||||
|
||||
try {
|
||||
const data = await getCurrentUser(token);
|
||||
return NextResponse.json(data);
|
||||
} catch {
|
||||
return NextResponse.json({ message: "Could not load user" }, { status: 401 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user