aboutsummaryrefslogtreecommitdiff
path: root/web/app/LoginManager.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/LoginManager.js')
-rw-r--r--web/app/LoginManager.js24
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,