minir fix
This commit is contained in:
1 parent
a87b94219d
commit
4909815807
5 files changed
+14
-4
No files matched your search
Binary file not shown.
@@ -10,7 +10,7 @@ export async function GET(req: Request) {
|
||||
const db = await getDatabase()
|
||||
const user = await db.getUserById(userId)
|
||||
|
||||
if (!user || user.role !== 'admin') {
|
||||
if (!user || (user.role !== 'admin' && user.role !== 'superAdmin')) {
|
||||
return new NextResponse('Forbidden', { status: 403 })
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,12 @@ export async function GET() {
|
||||
if (!userId) return new NextResponse('Unauthorized', { status: 401 })
|
||||
|
||||
const db = await getDatabase()
|
||||
const user = await db.getUserById(userId)
|
||||
|
||||
if (!user || (user.role !== 'admin' && user.role !== 'superAdmin')) {
|
||||
return new NextResponse('Forbidden', { status: 403 })
|
||||
}
|
||||
|
||||
const stats = await db.getDashboardStats()
|
||||
|
||||
return NextResponse.json(stats)
|
||||
|
||||
Reference in new issue
Block a user