expressServer/utils/loginUtil.js

10 lines
251 B
JavaScript

import FetchResult from '../common/web/fetchResult.js'
exports.authenticateSession = async (req, res, next) => {
if (req.session.user) {
next()
} else {
return FetchResult.formatResult(res, HTTP_STATUS.UNAUTHORIZED, 'Unauthorized')
}
}