diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-01 12:36:28 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-01 12:36:28 +1200 |
commit | d310875d1bf13baa13daba2ec73107dbeaa397f7 (patch) | |
tree | c18e3b7de87bfb470d6d2de2203e4236657a173b /web/app/LoginManager.js | |
parent | c91259f62618358ccf662a5d883f70df79ecbe65 (diff) | |
download | traccar-server-d310875d1bf13baa13daba2ec73107dbeaa397f7.tar.gz traccar-server-d310875d1bf13baa13daba2ec73107dbeaa397f7.tar.bz2 traccar-server-d310875d1bf13baa13daba2ec73107dbeaa397f7.zip |
Load server settings in web
Diffstat (limited to 'web/app/LoginManager.js')
-rw-r--r-- | web/app/LoginManager.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/web/app/LoginManager.js b/web/app/LoginManager.js index 914b7d6a9..93b3e913c 100644 --- a/web/app/LoginManager.js +++ b/web/app/LoginManager.js @@ -25,6 +25,30 @@ Ext.define('Traccar.LoginManager', { reader.readRecords(data).getRecords()[0]); }, + server: function(options) { + Ext.Ajax.request({ + scope: this, + url: '/api/server/get', + callback: this.onServerReturn, + original: options + }); + }, + + onServerReturn: function(options, success, response) { + options = options.original; + if (Traccar.ErrorManager.check(success, response)) { + var result = Ext.decode(response.responseText); + if (result.success) { + var reader = Ext.create('Ext.data.reader.Json', { + model: 'Traccar.model.Server' + }); + Traccar.getApplication().setServer( + reader.readRecords(result.data).getRecords()[0]); + } + Ext.callback(options.callback, options.scope, [result.success]); + } + }, + session: function(options) { Ext.Ajax.request({ scope: this, |