summaryrefslogtreecommitdiffstats
path: root/pyload/web/app/scripts/models/Setup.js
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/web/app/scripts/models/Setup.js')
-rw-r--r--pyload/web/app/scripts/models/Setup.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/pyload/web/app/scripts/models/Setup.js b/pyload/web/app/scripts/models/Setup.js
new file mode 100644
index 000000000..424edf452
--- /dev/null
+++ b/pyload/web/app/scripts/models/Setup.js
@@ -0,0 +1,34 @@
+define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'],
+ function($, Backbone, _, App, Api) {
+ 'use strict';
+
+ return Backbone.Model.extend({
+
+ url: App.apiUrl('setup'),
+ defaults: {
+ lang: 'en',
+ system: null,
+ deps: null,
+ user: null,
+ password: null
+ },
+
+ fetch: function(options) {
+ options || (options = {});
+ options.url = App.apiUrl('setup');
+ return Backbone.Model.prototype.fetch.call(this, options);
+ },
+
+ // will get a 409 on success
+ submit: function(options) {
+ options || (options = {});
+ options.url = App.apiUrl('setup_done');
+ options.data = {
+ user: this.get('user'),
+ password: this.get('password')
+ };
+ return Backbone.Model.prototype.fetch.call(this, options);
+ }
+
+ });
+ }); \ No newline at end of file