mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 14:37:13 +01:00
make isAdminSession usable by api routes
This commit is contained in:
@@ -4,6 +4,7 @@ import withSession, { isAdminSession } from '../../../../../lib/session'
|
||||
|
||||
export default withSession(async function billHandler(req, res) {
|
||||
if (!isAdminSession(req, res)) {
|
||||
res.status(403).send({ message: 'Not Authorized' })
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import { BOOKING_STATUS } from '../../../../../db/enums'
|
||||
|
||||
export default withSession(async function bookingHandler(req, res) {
|
||||
if (!isAdminSession(req, res)) {
|
||||
res.status(403).send({ message: 'Not Authorized' })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -42,8 +43,10 @@ export default withSession(async function bookingHandler(req, res) {
|
||||
|
||||
if (booking.status === BOOKING_STATUS.CONFIRMED) {
|
||||
sendBookingConfirmed(booking)
|
||||
console.log(`Booking ${booking.uuid} confirm sent`)
|
||||
} else if (booking.status === BOOKING_STATUS.REJECTED) {
|
||||
sendBookingRejected(booking)
|
||||
console.log(`Booking ${booking.uuid} rejected sent`)
|
||||
}
|
||||
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user