diff --git a/www/img/like.png b/www/img/like.png new file mode 100644 index 0000000..8b30fda Binary files /dev/null and b/www/img/like.png differ diff --git a/www/img/unlike.png b/www/img/unlike.png new file mode 100644 index 0000000..eae8921 Binary files /dev/null and b/www/img/unlike.png differ diff --git a/www/js/controllers.js b/www/js/controllers.js index cfe4f4d..1cdc19a 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -73,13 +73,16 @@ angular.module('starter.controllers', ['pascalprecht.translate']) localStorage.setItem("c_avatar", response.data.avatar); localStorage.setItem("c_userdata", JSON.stringify(response.data.userdata)); + + $timeout(function() { + $scope.closeLogin(); + $window.location.reload(true); + }, 1000); }else{ console.log("login failed"); + $ionicLoading.show({ template: 'Login failed, user or password error.', noBackdrop: true, duration: 2000 }); } - $timeout(function() { - $scope.closeLogin(); - $window.location.reload(true); - }, 1000); + }, function(response) { // optional @@ -101,6 +104,7 @@ angular.module('starter.controllers', ['pascalprecht.translate']) // success console.log("response: "); console.log(response.data); + $scope.loginData.username=$scope.signupData.username; $timeout(function() { $scope.closeSignup(); $scope.login(); @@ -202,7 +206,6 @@ angular.module('starter.controllers', ['pascalprecht.translate']) }*/ $scope.travels=""; - $scope.travels=JSON.parse(localStorage.getItem('c_travels')); $scope.userdata=JSON.parse(localStorage.getItem('c_userdata')); console.log($scope.userdata); @@ -467,6 +470,10 @@ angular.module('starter.controllers', ['pascalprecht.translate']) }) .then(function(response) { console.log(response); + $scope.travels=response.data; + localStorage.setItem('c_travels', JSON.stringify($scope.travels)); + localStorage.setItem('c_travelsLastDate', JSON.stringify(new Date())); + }, function(response) { // optional // failed @@ -685,6 +692,7 @@ console.log($scope.newComment); username: localStorage.getItem("c_username"), avatar: localStorage.getItem("c_avatar") }; + $scope.user.favs.push($scope.newfav);//al unfav no cal fer aquest simulacre pq ja no existeix a l'array i no el resta dos cops en cas de que cliquin dos cops $http({ //url: urlapi + 'users/'+ $stateParams.username+'/fav', url: urlapi + 'users/'+ $scope.user._id+'/fav', diff --git a/www/templates/signup.html b/www/templates/signup.html index 6598678..e414ebc 100644 --- a/www/templates/signup.html +++ b/www/templates/signup.html @@ -28,6 +28,10 @@ {{'Telegram' | translate }} +