diff --git a/isso/js/app/api.js b/isso/js/app/api.js index 2c5eba5..0bff7c0 100644 --- a/isso/js/app/api.js +++ b/isso/js/app/api.js @@ -129,12 +129,19 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) { }; var fetch = function(tid, limit, nested_limit, parent, lastcreated) { - if(typeof(limit) == 'undefined') limit = 0; - if(typeof(nested_limit) == 'undefined') nested_limit = 0; + if(typeof(limit) == 'undefined') limit = "inf"; + if(typeof(nested_limit) == 'undefined') nested_limit = "inf"; if(typeof(parent) == 'undefined') parent = null; + var query_dict = {uri: tid || location, after: lastcreated, parent: parent}; + if(limit != "inf") { + query_dict['limit'] = limit; + } + if(nested_limit != "inf"){ + query_dict['nested_limit'] = nested_limit; + } var deferred = Q.defer(); curl("GET", endpoint + "/?" + - qs({uri: tid || location, limit: limit, nested_limit: nested_limit, after: lastcreated, parent: parent}), null, function(rv) { + qs(query_dict), null, function(rv) { if (rv.status === 200) { deferred.resolve(JSON.parse(rv.body)); } else if (rv.status === 404) {