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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xianniu-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
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
- _getToken() {
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.token).then(response => response.json()).then((res) => {
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,