feat: admin controls
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { auth } from '~~/lib/auth';
|
||||
import { db } from '~~/server/lib/db';
|
||||
|
||||
/**
|
||||
@@ -6,14 +5,7 @@ import { db } from '~~/server/lib/db';
|
||||
* out on purpose: the client only ever needs the id to sign a device out.
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const sessionData = await auth.api.getSession({ headers: event.headers });
|
||||
|
||||
if (sessionData === null) {
|
||||
throw createError({
|
||||
statusCode: 401,
|
||||
statusMessage: 'Unauthorized',
|
||||
});
|
||||
}
|
||||
const sessionData = await protectRoute(event);
|
||||
|
||||
const result = await db.query.sessions.findMany({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user