delete travel implemented

This commit is contained in:
nau
2016-09-05 15:15:15 +02:00
parent 6c521940f6
commit bf29c64f9a
4 changed files with 33 additions and 11 deletions

View File

@@ -314,6 +314,9 @@ angular.module('starter.controllers', [])
})
.controller('TravelCtrl', function($scope, $stateParams, $http) {
if(localStorage.getItem('c_token')){// adding token to the headers
$http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('c_token');
}
$scope.storageusername=localStorage.getItem("c_username");
$scope.travel="";
console.log($stateParams.travelId);
@@ -329,6 +332,22 @@ angular.module('starter.controllers', [])
.then(function(result){
travels = result.data;
});
$scope.deleteTravel = function(){
console.log("delete travel: " + $stateParams.travelId);
$http({
url: urlapi + 'travels/' + $stateParams.travelId,
method: "DELETE"
})
.then(function(response) {
console.log(response);
},
function(response) { // optional
// failed
});
};
$scope.joinTravel = function(){
};
})
.controller('UsersCtrl', function($scope, $http, $ionicModal, $timeout) {