diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/Application.js | 15 | ||||
-rw-r--r-- | web/Login.js | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/web/Application.js b/web/Application.js index c522d50f7..594ce0635 100644 --- a/web/Application.js +++ b/web/Application.js @@ -37,11 +37,22 @@ Ext.Loader.loadScript({ name: 'Traccar', requires: [ 'Styles', - 'Login' + 'Login', + 'MainView' ], launch: function() { - Ext.create('Login').show(); + Ext.Ajax.request({ + url: '/api/session', + success: function(response) { + var result = Ext.decode(response.responseText); + if (result.success && result.session) { + Ext.create('MainView', { renderTo: document.body }); + } else { + Ext.create('Login').show(); + } + } + }) } }); } diff --git a/web/Login.js b/web/Login.js index 6fef9ce9d..871bef17b 100644 --- a/web/Login.js +++ b/web/Login.js @@ -65,7 +65,7 @@ Ext.define('Login', { closable: false, items: [{ xtype: 'login-form' }], - + submit: function() { var win = this; var form = this.down('form').getForm(); |