summaryrefslogtreecommitdiffstats
path: root/afb-client/app/Frontend/pages
diff options
context:
space:
mode:
Diffstat (limited to 'afb-client/app/Frontend/pages')
-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
-rw-r--r--afb-client/app/Frontend/pages/Sample/Sample.html4
4 files changed, 18 insertions, 4 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;
diff --git a/afb-client/app/Frontend/pages/Sample/Sample.html b/afb-client/app/Frontend/pages/Sample/Sample.html
index 00a6f3b..e7e9164 100644
--- a/afb-client/app/Frontend/pages/Sample/Sample.html
+++ b/afb-client/app/Frontend/pages/Sample/Sample.html
@@ -7,7 +7,9 @@ controller: SampleController as ctrl
animationIn: slideInRight
---
-<h1><img class="logo" src="images/logo/triskel_iot_bzhx250.png" alt="IoT.bzh Logo" style="height:150px;"> Sample Page</h1>
+<h1><img class="logo" src="images/logo/triskel_iot_bzhx250.png" alt="IoT.bzh Logo" style="height:150px;">
+ Not Working
+</h1>
<div class="sample-box box-content">