refactor(rest) onFSGet

This commit is contained in:
coderaiser 2014-03-05 05:53:07 -05:00
parent 9fca915d72
commit e3a5ccc012

View file

@ -132,13 +132,16 @@
switch (p.request.method) {
case 'GET':
onFSGet(query, p.name, function(error, data, isFile) {
var str;
if (error)
sendError(params, error);
else if (isFile)
main.sendFile(p);
else {
p.name += '.json';
sendResponse(p, data);
str = Util.stringifyJSON(data);
sendResponse(p, str);
}
});
@ -347,13 +350,7 @@
if (!isDir)
func(null, null, !isDir);
else
getDirContent(name, function(error, data) {
if (!error) {
data = Util.stringifyJSON(data);
}
func(error, data);
});
getDirContent(name, func);
});
break;
}