diff options
Diffstat (limited to 'module/web/static/js/views/linkGrabberModal.js')
-rw-r--r-- | module/web/static/js/views/linkGrabberModal.js | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/module/web/static/js/views/linkGrabberModal.js b/module/web/static/js/views/linkGrabberModal.js index 71f97f0bf..3d9a886db 100644 --- a/module/web/static/js/views/linkGrabberModal.js +++ b/module/web/static/js/views/linkGrabberModal.js @@ -26,23 +26,22 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'text!tpl/def addPackage: function(e) { var self = this; - var settings = { - type: 'POST', - data: { - name: JSON.stringify($('#inputPackageName').val()), - links: JSON.stringify(['http://download.pyload.org/random.bin', 'http://download.pyload.org/random100.bin', - 'invalid link', 'invalid link 2', 'invalid link 3', 'inavlid link 4', - 'http://download.pyload.org/random.bin', 'http://download.pyload.org/random.bin', 'http://download.pyload.org/random.bin', - 'A really really long invalid url that should exceed length of most of the urls by far and split into two lines']) + var options = App.apiRequest('addPackage', + { + name: $('#inputPackageName').val(), + // TODO: better parsing / tokenization + links: $('#inputLinks').val().split("\n") }, - success: function() { - App.vent.trigger('package:added'); - self.hide(); - } - }; - - $.ajax('api/addPackage', settings); + { + success: function() { + App.vent.trigger('package:added'); + self.hide(); + } + }); + + $.ajax(options); $('#inputPackageName').val(''); + $('#inputLinks').val(''); }, onShow: function() { |