mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(rest) read: add optional dataType
This commit is contained in:
parent
0af0190688
commit
afa89f38fa
2 changed files with 10 additions and 4 deletions
|
|
@ -395,7 +395,7 @@ var Util, DOM, CloudFunc;
|
|||
if (!isRefresh && json)
|
||||
CloudCmd.createFileTable(obj, panel);
|
||||
else
|
||||
RESTful.read(cleanPath, function(json) {
|
||||
RESTful.read(cleanPath, 'json', function(json) {
|
||||
CloudCmd.createFileTable(json, panel);
|
||||
Storage.set(cleanPath, json);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -36,15 +36,21 @@ var Util, DOM, CloudFunc;
|
|||
});
|
||||
};
|
||||
|
||||
this.read = function(url, callback) {
|
||||
var isQuery = Util.isContainStr(url, '?');
|
||||
this.read = function(url, dataType, callback) {
|
||||
var isQuery = Util.isContainStr(url, '?'),
|
||||
isFunc = Util.isFunction(dataType);
|
||||
|
||||
if (!callback && isFunc) {
|
||||
callback = dataType;
|
||||
dataType = 'text';
|
||||
}
|
||||
|
||||
sendRequest({
|
||||
method : 'GET',
|
||||
url : CloudFunc.FS + url,
|
||||
callback : callback,
|
||||
notLog : !isQuery,
|
||||
dataType : 'text'
|
||||
dataType : dataType
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue