removed oAuth endpoint from dispatch, started oAuth endpoints for moodle
This commit is contained in:
21
apps/hub/app/api/user/route.ts
Normal file
21
apps/hub/app/api/user/route.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { getServerSession } from "../auth/[...nextauth]/auth";
|
||||
import { prisma } from "@repo/db";
|
||||
|
||||
export const GET = async (req: NextRequest) => {
|
||||
const session = await getServerSession();
|
||||
if (!session) {
|
||||
return {
|
||||
status: 401,
|
||||
body: "Unauthorized",
|
||||
};
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: session.user.id,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(user);
|
||||
};
|
||||
Reference in New Issue
Block a user