diff --git a/www/js/controllers.js b/www/js/controllers.js index 0b2653c..cfe4f4d 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -1,6 +1,6 @@ -var urlapi="http://localhost:3000/api/"; -//var urlapi="https://collectivecar.paas.primustech.io/api/"; +//var urlapi="http://localhost:3000/api/"; +var urlapi="https://collectivecar.paas.primustech.io/api/"; //localStorage.setItem("c_username", "user2"); @@ -177,6 +177,15 @@ angular.module('starter.controllers', ['pascalprecht.translate']) localStorage.removeItem("c_userdata"); $window.location.reload(true); }; + + /* if no logged, suggest to login */ + if(localStorage.getItem('c_token')){// adding token to the headers + $http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('c_token'); + }else{ + setTimeout(function(){ + $scope.login(); + },1000); + } }) diff --git a/www/templates/login.html b/www/templates/login.html index 611dd8e..d051458 100644 --- a/www/templates/login.html +++ b/www/templates/login.html @@ -2,6 +2,7 @@

{{'Login' | translate}}

+