feat: 修复退出登录登录信息未失效

This commit is contained in:
2025-09-06 20:42:52 +08:00
parent cd99485c9a
commit f0e1a649ee
7 changed files with 52 additions and 14 deletions

View File

@@ -10,11 +10,10 @@ export class Authorization implements Middleware {
apply(app: Koa) {
app.use(async (ctx: Koa.Context, next: Koa.Next) => {
console.log('ctx.path', ctx.path)
if (this.ignoreAuth.includes(ctx.path)) {
return next();
}
if (ctx.session.isNew) {
if (ctx.session.user == null) {
ctx.throw(401, 'Unauthorized');
}
await next();