mm_session 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +3 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2,7 +2,7 @@ const Store = require('./store.js');
2
2
 
3
3
  module.exports = (opts = {}) => {
4
4
  const {
5
- key = $.dict.session_id ? $.dict.session_id : "mm:uuid", store = new Store()
5
+ key = $.dict.session_id || "mm:uuid", store = new Store()
6
6
  } = opts;
7
7
 
8
8
  return async (ctx, next) => {
@@ -81,11 +81,11 @@ module.exports = (opts = {}) => {
81
81
 
82
82
  // 建立/更新会话
83
83
  var o = Object.assign({}, opts, {
84
- uuid: ctx.session.uuid ? ctx.session.uuid : uuid
84
+ uuid: ctx.session.uuid || uuid
85
85
  });
86
86
  const sid = await store.set(ctx.session, o, ctx);
87
87
 
88
88
  var cg = Object.assign({}, opts);
89
89
  if (!uuid || uuid !== sid || need_refresh) ctx.cookies.set(key, sid, cg);
90
90
  }
91
- }
91
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_session",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "这是超级美眉session函数模块,用于web服务端session缓存",
5
5
  "main": "index.js",
6
6
  "scripts": {