diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2016-02-09 18:40:49 +0100 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2016-02-09 18:40:49 +0100 |
commit | 3d2fda7dd39e2363682f1fa353c951ab0d44ddfa (patch) | |
tree | af968a8ac5d4fde1f3cebcec5fb0973eb2bfb2cb /afb-client/app/Frontend/app.js | |
parent | 12a3520ba440316c76b95d92a684666f03f7b47d (diff) |
Implemented URL query parsing for initial token /opa/?token=abcde
Diffstat (limited to 'afb-client/app/Frontend/app.js')
-rw-r--r-- | afb-client/app/Frontend/app.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/afb-client/app/Frontend/app.js b/afb-client/app/Frontend/app.js index 72e8123..ed4d2ea 100644 --- a/afb-client/app/Frontend/app.js +++ b/afb-client/app/Frontend/app.js @@ -1,5 +1,13 @@ (function() { 'use strict'; + + function ParseQueryString () { + var qd = {}; + location.search.substr(1).split("&").forEach(function(item) { + var k = item.split("=")[0], v = decodeURIComponent(item.split("=")[1]); (k in qd) ? qd[k].push(v) : qd[k] = [v]; + }); + return qd; + } angular.module('@@APPNAME@@', [ // Warning: Appname should fit with gulpfile.js & index.html 'ui.router', @@ -24,14 +32,13 @@ 'RangeSlider', 'ModalNotification' ]) + .value ('urlquery', ParseQueryString()) .config(config) .run(run) ; config.$inject = ['$urlRouterProvider', '$locationProvider']; - console.log ("***location=" + window.location + " search" + window.search); - function config($urlProvider, $locationProvider, ConfigApp) { $urlProvider.otherwise('/home'); |