diff --git a/index.js b/index.js index 928ea43..6eb4fb5 100644 --- a/index.js +++ b/index.js @@ -30,10 +30,10 @@ export default class Controller { let { __mix_key__ } = this.request return this.context.$$jwt.sign(data, __mix_key__) }, - verify: () => { + verify: token => { this.#auth = null - let token = this.request.header('authorization') let { __mix_key__ } = this.request + token ??= this.request.header('authorization') if (token) { this.#auth = this.context.$$jwt.verify(token, __mix_key__) diff --git a/package.json b/package.json index acf458c..738c414 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gm5/controller", - "version": "2.0.2", + "version": "2.0.3", "type": "module", "description": "控制器基类。", "main": "index.js",