mirror of
https://github.com/arnaucube/commonroutesApp.git
synced 2026-02-07 11:36:42 +01:00
decline join travel and leave travel implemented
This commit is contained in:
@@ -125,6 +125,27 @@ angular.module('app.travel', ['pascalprecht.translate', 'ui-leaflet'])
|
||||
});
|
||||
};
|
||||
|
||||
$scope.declineJoin = function(joinPetition){
|
||||
$http({
|
||||
url: urlapi + 'travels/declineJoin/'+ $stateParams.travelid,
|
||||
method: "POST",
|
||||
data: {userid: joinPetition._id}
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data);
|
||||
if(data.success==false){
|
||||
$ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000});
|
||||
}else{
|
||||
$scope.travel=data.data;
|
||||
console.log("success");
|
||||
}
|
||||
},
|
||||
function(response) { // optional
|
||||
// failed
|
||||
});
|
||||
};
|
||||
|
||||
$scope.acceptJoin = function(joinPetition){
|
||||
$http({
|
||||
url: urlapi + 'travels/acceptJoin/'+ $stateParams.travelid,
|
||||
@@ -146,6 +167,26 @@ angular.module('app.travel', ['pascalprecht.translate', 'ui-leaflet'])
|
||||
});
|
||||
};
|
||||
|
||||
$scope.leaveTravel = function(){
|
||||
$http({
|
||||
url: urlapi + 'travels/leave/'+ $stateParams.travelid,
|
||||
method: "POST",
|
||||
data: {}
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data);
|
||||
if(data.success==false){
|
||||
$ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000});
|
||||
}else{
|
||||
$scope.travel=data.data;
|
||||
}
|
||||
},
|
||||
function(response) { // optional
|
||||
// failed
|
||||
});
|
||||
};
|
||||
|
||||
/* adding comment */
|
||||
$scope.doingNewComment=false;
|
||||
$scope.newComment={};
|
||||
|
||||
Reference in New Issue
Block a user