first commit

This commit is contained in:
2026-07-30 12:15:17 +03:00
commit 1f29eead28
48 changed files with 10666 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import { auth } from '@/lib/auth'
import { NextResponse } from 'next/server'
export async function requireAdmin() {
const session = await auth()
if (!session || (session.user as { role?: string }).role !== 'ADMIN') {
throw new Error('Unauthorized')
}
return session
}
export function unauthorized() {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
}