diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-29 23:29:43 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-29 23:29:43 +1200 |
commit | 8e6e361eb0e1d4c92b99fa20a70f0fa7b296a466 (patch) | |
tree | 9a1a69460652a0da7507c5fc2dec724290e30845 /web/Application.js | |
parent | 2b0610469c10f99dd21393cbbed81a9d0d06b868 (diff) | |
download | trackermap-server-8e6e361eb0e1d4c92b99fa20a70f0fa7b296a466.tar.gz trackermap-server-8e6e361eb0e1d4c92b99fa20a70f0fa7b296a466.tar.bz2 trackermap-server-8e6e361eb0e1d4c92b99fa20a70f0fa7b296a466.zip |
Check if user is logged in
Diffstat (limited to 'web/Application.js')
-rw-r--r-- | web/Application.js | 15 |
1 files changed, 13 insertions, 2 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(); + } + } + }) } }); } |