fix(account middleware): 使用了未定义的变量。

This commit is contained in:
Ivan Li 2021-07-10 17:37:21 +08:00
parent 02059ee54f
commit c3c73fbe65
2 changed files with 2 additions and 2 deletions

View File

@ -19,6 +19,6 @@ db:
etcd: etcd:
hosts: hosts:
- 'http://192.168.31.194:2379' - 'http://192.168.31.194:2379'
workspaces: workspaces:
root: '/Users/ivanli/Projects/fennec/workspaces' root: '/Users/ivanli/Projects/fennec/workspaces'

View File

@ -11,7 +11,7 @@ export class AccountMiddleware implements NestMiddleware {
async use(req: any, res: any, next: () => void) { async use(req: any, res: any, next: () => void) {
const authPayload = req.header('authorization') ?? ''; const authPayload = req.header('authorization') ?? '';
if (!authPayload) { if (!authPayload) {
req.user = req.session.user; req.user = req.session?.user;
next(); next();
return; return;
} }