This commit is contained in:
2025-03-23 16:47:49 +08:00
parent c463e055bc
commit 275e637f62
3 changed files with 20 additions and 9 deletions

View File

@@ -5,4 +5,12 @@ import { UserServices, User, UserInit, UserModel } from './models/user.ts';
import { Org, OrgInit, OrgModel } from './models/org.ts';
import { addAuth } from './middleware/auth.ts';
export { User, Org, UserServices, UserInit, OrgInit, UserModel, OrgModel };
/**
* 可以不需要user成功, 有则赋值,交给下一个中间件
*/
export const authCan = 'auth-can';
/**
* 必须需要user成功
*/
export const auth = 'auth';
export { addAuth };

View File

@@ -3,6 +3,9 @@ import type { App } from '@kevisual/router';
/**
* 添加auth中间件, 用于验证token
* 添加 id: auth 必须需要user成功
* 添加 id: auth-can 可以不需要user成功有则赋值
*
* @param app
*/
export const addAuth = (app: App) => {