summaryrefslogtreecommitdiffstats
path: root/afb-client/app/Frontend/pages/Home
diff options
context:
space:
mode:
Diffstat (limited to 'afb-client/app/Frontend/pages/Home')
-rw-r--r--afb-client/app/Frontend/pages/Home/Home.html1
-rw-r--r--afb-client/app/Frontend/pages/Home/HomeModule.js11
-rw-r--r--afb-client/app/Frontend/pages/Home/HomeModule.scss6
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;