mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
move admin api to /admin
This commit is contained in:
@@ -15,3 +15,12 @@ export default function withSession(handler: Handler) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const isAdminSession = function (req: any, res: any) {
|
||||
const user = req?.session.get('user')
|
||||
if (user && user.role === 'admin') {
|
||||
return true
|
||||
}
|
||||
res.status(401).end('Your are unauthorized. Best to move along...')
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user