- 更新所有文件的导入和导出语法,使用 ES6 模块格式 - 修改 package.json,添加 "type": "module" 配置 - 调整部分代码结构以适应 ES6 模块
12 lines
317 B
JavaScript
12 lines
317 B
JavaScript
import FetchResult from '../common/web/fetchResult.js'
|
|
|
|
import { HTTP_STATUS } from '../common/constant/httpStatus.js'
|
|
|
|
export async function authenticateSession(req, res, next) {
|
|
if (req.session.user) {
|
|
next()
|
|
} else {
|
|
return FetchResult.formatResult(res, HTTP_STATUS.UNAUTHORIZED, 'Unauthorized')
|
|
}
|
|
}
|