From 38d94e65e9bb46cc10cbe7559daa41d1468ba853 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 18 Nov 2016 17:12:14 +0500 Subject: Fix passing parameter and variable declaration --- web/app/controller/Root.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index b0067c01..adc188c0 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -37,11 +37,14 @@ Ext.define('Traccar.controller.Root', { var tokenParameter; if (success) { Traccar.app.setServer(Ext.decode(response.responseText)); - tokenParameter = window.location.search.match('/token=([a-zA-Z0-9]+)/'); - tokenParameter = tokenParameter !== null ? '?' + tokenParameter[0] : ''; + tokenParameter = window.location.search.match('token=([a-zA-Z0-9]+)'); Ext.Ajax.request({ scope: this, - url: 'api/session' + tokenParameter, + url: 'api/session', + method: 'GET', + params: tokenParameter !== null ? { + token: tokenParameter[1] + } : {}, callback: this.onSessionReturn }); } else { -- cgit v1.2.3