xianniu-ui 0.6.0 → 0.6.1
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.
- package/lib/xianniu-ui.common.js +21 -22
- package/lib/xianniu-ui.umd.js +21 -22
- package/lib/xianniu-ui.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/oss/index.js +2 -3
package/package.json
CHANGED
package/src/oss/index.js
CHANGED
|
@@ -5,11 +5,10 @@ const { v4: uuidv4 } = require('uuid');
|
|
|
5
5
|
class Client {
|
|
6
6
|
constructor(params = {}) {
|
|
7
7
|
this.uploadHost = null
|
|
8
|
-
this.token = localStorage.getItem('xnToken')
|
|
9
8
|
this.stsUrl = params.stsUrl || ''
|
|
10
9
|
this.oss = null
|
|
11
10
|
}
|
|
12
|
-
|
|
11
|
+
getToken() {
|
|
13
12
|
const _token = localStorage.getItem('xnToken')
|
|
14
13
|
let token = ''
|
|
15
14
|
if (_token) {
|
|
@@ -38,7 +37,7 @@ class Client {
|
|
|
38
37
|
if (!this.stsUrl) {
|
|
39
38
|
return console.error('获取临时凭证地址不能为空')
|
|
40
39
|
}
|
|
41
|
-
fetch(this.stsUrl + '?xnToken=' + this.
|
|
40
|
+
fetch(this.stsUrl + '?xnToken=' + this.getToken()).then(response => response.json()).then((res) => {
|
|
42
41
|
const { data: { accessKeyId, accessKeySecret, securityToken: stsToken, uploadHost, bucket, region } } = res
|
|
43
42
|
const obj = {
|
|
44
43
|
accessKeyId,
|