How can I refactor this code to be more clean?
$scope.unreserve = function () {
var params = {
'wishlist_product_id' : product.wishlist_product_id
};
WishlistService.unreserve(params, function (data) {
if (data.success) {
$rootScope.$broadcast('NotificationController.create', {type: 'success', message: 'Unreserve successfully'});
} else {
$rootScope.$broadcast('NotificationController.create', {type: 'error', message: data.error_message});
}
});
};
$scope.createManualProduct = function () {
var params = {};
ProductService.addManualProduct(params, function (data) {
if (data.success) {
$rootScope.$broadcast('NotificationController.create', {type: 'success', message: 'Unreserve successfully'});
} else{
$rootScope.$broadcast('NotificationController.create', {type: 'error', message: data.error_message});
}
});
};