diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2015-12-16 19:17:46 +0100 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2015-12-16 19:17:46 +0100 |
commit | fbdd26b4a4aa8eb3d83333fe44e93590bc174e11 (patch) | |
tree | 6c3728c7c05d3e411d97fe9e8da7d3a861a36c73 /afb-client/app/Frontend/pages/Home/HomeModule.js | |
parent | 72eb409f785b23038d87f3513687e2e1ed4dbb7d (diff) |
Work in Progress
Diffstat (limited to 'afb-client/app/Frontend/pages/Home/HomeModule.js')
-rw-r--r-- | afb-client/app/Frontend/pages/Home/HomeModule.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/afb-client/app/Frontend/pages/Home/HomeModule.js b/afb-client/app/Frontend/pages/Home/HomeModule.js index 11b3882..ba6c5ea 100644 --- a/afb-client/app/Frontend/pages/Home/HomeModule.js +++ b/afb-client/app/Frontend/pages/Home/HomeModule.js @@ -1,10 +1,10 @@ (function() { 'use strict'; - var INITIAL_TOKEN=123456789; // should match with --token=xxxx binder command line +// WARNING: make sure than app/frontend/services/ConfigApp.js match your server // list all rependencies within the page + controler if needed -angular.module('HomeModule', ['SubmitButton']) +angular.module('HomeModule', ['SubmitButton', 'TokenRefresh']) .controller('HomeController', function ($http, ConfigApp) { var scope = this; // I hate JavaScript @@ -21,6 +21,11 @@ angular.module('HomeModule', ['SubmitButton']) scope.errcode= errcode; scope.request = data.request; scope.response = data.response; + + // if token was refresh let's update ConfigApp + if (data.request.token) ConfigApp.session.token = data.request.token; + if (data.request.uuid) ConfigApp.session.uuid = data.request.uuid; + if (data.request.timeout) ConfigApp.session.timeout = data.request.timeout; // Make sure we clean everything when Open/Close is called if (apiname === "APIcreate" || apiname === "APIreset") { @@ -51,7 +56,7 @@ angular.module('HomeModule', ['SubmitButton']) scope.OpenSession = function() { console.log ("OpenSession"); var postdata= {/* any json your application may need */}; - var handler = $http.post(ConfigApp.api.token + 'create?token='+INITIAL_TOKEN, postdata); + var handler = $http.post(ConfigApp.api.token + 'create?token='+ConfigApp.session.token, postdata); handler.success(scope.ProcessResponse); handler.error(scope.ProcessError); |