Browse Source

chore: optimize example code

罗章 6 years ago
parent
commit
00ba5c2273
2 changed files with 10 additions and 12 deletions
  1. 7
    9
      Example/App.js
  2. 3
    3
      Example/Component/AuthManager.js

+ 7
- 9
Example/App.js View File

14
 import { ObjectManager } from './Component/ObjectManager'
14
 import { ObjectManager } from './Component/ObjectManager'
15
 
15
 
16
 import AliyunOSS from 'aliyun-oss-react-native'
16
 import AliyunOSS from 'aliyun-oss-react-native'
17
+
17
 //open log 
18
 //open log 
18
 AliyunOSS.enableDevMode()
19
 AliyunOSS.enableDevMode()
20
+
19
 // defalut configraiton
21
 // defalut configraiton
20
 const configuration = {
22
 const configuration = {
21
    maxRetryCount: 3,  
23
    maxRetryCount: 3,  
22
    timeoutIntervalForRequest: 30,
24
    timeoutIntervalForRequest: 30,
23
    timeoutIntervalForResource: 24 * 60 * 60
25
    timeoutIntervalForResource: 24 * 60 * 60
24
 };
26
 };
25
-const config = {
26
-  AccessKey: 'XXX',
27
-  SecretKey: 'XXX',
28
-};
29
-const endPoint = 'oss-cn-zhangjiakou.aliyuncs.com';
30
-const companyserver = "http://XXX:PORT";
31
-const familyserver = "http://XXX:PORT";
32
 
27
 
33
-// AliyunOSS.initWithPlainTextAccessKey(config.AccessKey, config.SecretKey, endPoint, configuration);
34
-AliyunOSS.initWithServerSTS(familyserver,endPoint, configuration)
28
+const endPoint = 'oss-cn-XXX.aliyuncs.com';
29
+const authserver = "http://XXX:PORT";
30
+
31
+// initWithServerSTS to auth
32
+AliyunOSS.initWithServerSTS(authserver,endPoint, configuration)
35
 
33
 
36
 type Props = {};
34
 type Props = {};
37
 
35
 

+ 3
- 3
Example/Component/AuthManager.js View File

12
 
12
 
13
 
13
 
14
 const configuration = {
14
 const configuration = {
15
-   maxRetryCount: 3,  
16
-   timeoutIntervalForRequest: 30,
17
-   timeoutIntervalForResource: 24 * 60 * 60
15
+  maxRetryCount: 3,  
16
+  timeoutIntervalForRequest: 30,
17
+  timeoutIntervalForResource: 24 * 60 * 60
18
 };
18
 };
19
 
19
 
20
 const config = {
20
 const config = {