w-web-perm 1.0.16 → 1.0.18

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.
@@ -925,7 +925,7 @@
925
925
  <br class="clear">
926
926
 
927
927
  <footer>
928
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 16:34:06 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
928
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 19:01:38 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
929
929
  </footer>
930
930
 
931
931
  <script>prettyPrint();</script>
@@ -273,7 +273,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, verifyBrowserUser, verifyAppUse
273
273
  //mappingBy
274
274
  let mappingBy = get(opt, 'mappingBy', '')
275
275
  if (mappingBy !== 'id' &amp;&amp; mappingBy !== 'email' &amp;&amp; mappingBy !== 'name') {
276
- mappingBy = 'email'
276
+ mappingBy = 'id'
277
277
  }
278
278
  // console.log('mappingBy', mappingBy)
279
279
 
@@ -1160,7 +1160,7 @@ export default WWebPerm
1160
1160
  <br class="clear">
1161
1161
 
1162
1162
  <footer>
1163
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 16:34:06 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1163
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 19:01:38 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1164
1164
  </footer>
1165
1165
 
1166
1166
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -71,7 +71,7 @@
71
71
  <br class="clear">
72
72
 
73
73
  <footer>
74
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 16:34:06 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 19:01:38 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
75
75
  </footer>
76
76
 
77
77
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-web-perm",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "main": "dist/w-web-perm.umd.js",
5
5
  "dependencies": {
6
6
  "@mdi/js": "^7.4.47",
@@ -226,7 +226,7 @@ function WWebPerm(WOrm, url, db, getUserByToken, verifyBrowserUser, verifyAppUse
226
226
  //mappingBy
227
227
  let mappingBy = get(opt, 'mappingBy', '')
228
228
  if (mappingBy !== 'id' && mappingBy !== 'email' && mappingBy !== 'name') {
229
- mappingBy = 'email'
229
+ mappingBy = 'id'
230
230
  }
231
231
  // console.log('mappingBy', mappingBy)
232
232
 
package/src/perm.mjs CHANGED
@@ -2,7 +2,6 @@ import axios from 'axios'
2
2
  import get from 'lodash-es/get.js'
3
3
  import each from 'lodash-es/each.js'
4
4
  import isestr from 'wsemi/src/isestr.mjs'
5
- import isbol from 'wsemi/src/isbol.mjs'
6
5
  import isfun from 'wsemi/src/isfun.mjs'
7
6
  import genPm from 'wsemi/src/genPm.mjs'
8
7
  import pmInvResolve from 'wsemi/src/pmInvResolve.mjs'
@@ -28,12 +27,6 @@ function perm() {
28
27
  throw new Error(`url does not include 'userId='`)
29
28
  }
30
29
 
31
- //useAsync
32
- let useAsync = get(opt, 'useAsync')
33
- if (!isbol(useAsync)) {
34
- useAsync = false
35
- }
36
-
37
30
  //permSuccess
38
31
  let permSuccess = get(opt, 'permSuccess')
39
32
 
@@ -41,10 +34,7 @@ function perm() {
41
34
  let permError = get(opt, 'permError')
42
35
 
43
36
  //pm
44
- let pm = null
45
- if (useAsync) {
46
- pm = genPm()
47
- }
37
+ let pm = genPm()
48
38
 
49
39
  //get
50
40
  let pms = axios.get(url)
@@ -56,24 +46,17 @@ function perm() {
56
46
  if (isfun(permSuccess)) {
57
47
  permSuccess(pmd)
58
48
  }
59
- if (useAsync) {
60
- pm.resolve(kp)
61
- }
49
+ pm.resolve(pmd)
62
50
  })
63
51
  .catch((err) => {
64
52
  // console.log('perm.getPerm catch', err)
65
53
  if (isfun(permError)) {
66
54
  permError(err)
67
55
  }
68
- if (useAsync) {
69
- pm.reject()
70
- }
56
+ pm.reject(err)
71
57
  })
72
58
 
73
- if (useAsync) {
74
- return pm
75
- }
76
- return kp
59
+ return pm
77
60
  }
78
61
 
79
62
  //user