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,24 +14,22 @@ import { BucketManager } from './Component/BucketManager'
14 14
 import { ObjectManager } from './Component/ObjectManager'
15 15
 
16 16
 import AliyunOSS from 'aliyun-oss-react-native'
17
+
17 18
 //open log 
18 19
 AliyunOSS.enableDevMode()
20
+
19 21
 // defalut configraiton
20 22
 const configuration = {
21 23
    maxRetryCount: 3,  
22 24
    timeoutIntervalForRequest: 30,
23 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 34
 type Props = {};
37 35
 

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

@@ -12,9 +12,9 @@ import {
12 12
 
13 13
 
14 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 20
 const config = {