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 | |
parent | 72eb409f785b23038d87f3513687e2e1ed4dbb7d (diff) |
Work in Progress
Diffstat (limited to 'afb-client/app/Frontend/pages/Home')
-rw-r--r-- | afb-client/app/Frontend/pages/Home/Home.html | 1 | ||||
-rw-r--r-- | afb-client/app/Frontend/pages/Home/HomeModule.js | 11 | ||||
-rw-r--r-- | afb-client/app/Frontend/pages/Home/HomeModule.scss | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/afb-client/app/Frontend/pages/Home/Home.html b/afb-client/app/Frontend/pages/Home/Home.html index 9803b63..9b9cc01 100644 --- a/afb-client/app/Frontend/pages/Home/Home.html +++ b/afb-client/app/Frontend/pages/Home/Home.html @@ -12,6 +12,7 @@ animationIn: slideInRight App Framework Binder Simple Client </h3> +<token-refresh></token-refresh> <div class="button-box box-content "> 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); diff --git a/afb-client/app/Frontend/pages/Home/HomeModule.scss b/afb-client/app/Frontend/pages/Home/HomeModule.scss index 34e1181..8bf04a1 100644 --- a/afb-client/app/Frontend/pages/Home/HomeModule.scss +++ b/afb-client/app/Frontend/pages/Home/HomeModule.scss @@ -21,6 +21,12 @@ $COLOR_SUCCESS: green; $COLOR_FAIL: red; +token-refresh { + display: block; + float: right; + margin: .5rem 1rem 0 0; +} + .button-box { height : 4.5rem; |