mirror of
https://github.com/arnaucube/commonroutesApp.git
synced 2026-02-07 03:26:44 +01:00
delete travel implemented
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user