diff options
author | 2013-03-20 21:39:30 +0100 | |
---|---|---|
committer | 2013-03-20 21:39:30 +0100 | |
commit | 63cef4c7d641ffddaeabcd768020674e2681ba05 (patch) | |
tree | 10b9ee50b927a7673d93db15b896a15a1012f482 /module/web/static/js/app.js | |
parent | added ReadWrite lock, render file progress on dashboard (diff) | |
download | pyload-63cef4c7d641ffddaeabcd768020674e2681ba05.tar.xz |
improved ui, render waiting files
Diffstat (limited to 'module/web/static/js/app.js')
-rw-r--r-- | module/web/static/js/app.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/module/web/static/js/app.js b/module/web/static/js/app.js index 59ad04fc9..53af4b797 100644 --- a/module/web/static/js/app.js +++ b/module/web/static/js/app.js @@ -28,10 +28,21 @@ define([ // Add Global Helper functions _.extend(Application.prototype, Backbone.Events, { - apiCall: function(method, args, options) { + // Generates options dict that can be used for xhr requests + apiRequest: function(method, data, options) { options || (options = {}); - - + options.url = window.pathPrefix + "/api/" + method; + options.dataType = "json"; + if (data) { + options.type = "POST"; + options.data = {}; + // Convert arguments to json + _.keys(data).map(function(key) { + options.data[key] = JSON.stringify(data[key]); + }); + } + + return options; }, openWebSocket: function(path) { |