mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
* fix: 204 no content response * Update data-wrapping.ts * Update plugin.ts Co-authored-by: chenos <chenlinxh@gmail.com>
12 lines
345 B
TypeScript
12 lines
345 B
TypeScript
// TODO(usage): 拦截用户的处理暂时作为一个中间件导出,应用需要的时候可以直接使用这个中间件
|
|
export function check(options) {
|
|
return async function check(ctx, next) {
|
|
const { currentUser } = ctx.state;
|
|
|
|
if (!currentUser) {
|
|
return ctx.throw(401, 'Unauthorized');
|
|
}
|
|
return next();
|
|
};
|
|
}
|