File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,18 @@ module.exports = function(AV) {
108108 AV . _useMasterKey = false ;
109109 } ;
110110
111+ const setRegion = ( region ) => {
112+ // 服务器地区选项,默认为中国大陆
113+ switch ( region ) {
114+ case 'cn' :
115+ AVConfig . region = 'cn' ;
116+ break ;
117+ case 'us' :
118+ AVConfig . region = 'us' ;
119+ break ;
120+ }
121+ } ;
122+
111123 /**
112124 * Call this method first to set up your authentication tokens for AV.
113125 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
@@ -127,13 +139,7 @@ module.exports = function(AV) {
127139 throw new Error ( 'AV.init(): Master Key is only used in Node.js.' ) ;
128140 }
129141 initialize ( options . appId , options . appKey , options . masterKey ) ;
130-
131- // 服务器地区选项,默认为中国大陆
132- switch ( options . region ) {
133- case 'us' :
134- AVConfig . region = 'us' ;
135- break ;
136- }
142+ setRegion ( options . region ) ;
137143 } else {
138144 throw new Error ( 'AV.init(): Parameter is not correct.' ) ;
139145 }
You can’t perform that action at this time.
0 commit comments