Project

General

Profile

« Previous | Next » 

Revision 33235

open the api page after the registration

View differences:

modules/dnet-modular-repositories-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/addRepoApi.js
218 218
	}
219 219
	
220 220
	$scope.registerApi = function() {
221
		$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
222
		$http.post('repoApi.new', $.param({
223
			'repoId' : $scope.repo.origId,
224
			'iface'  : JSON.stringify($scope.api)
225
		})).success(function(res) {
226
            	$scope.hideSpinner();
227
            	if(res) {
228
            		$scope.showNotification('The API has been registered');
229
            		$scope.resetForm();
230
            	} else {
231
            		$scope.showError('Registration failed');
232
            	}
233
		}).error(function(message) {
234
			$scope.hideSpinner();
235
			$scope.showError('Registration failed: ' + message);
236
		});
221
		if (confirm('Are you sure ?')) {
222
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
223
			$http.post('repoApi.new', $.param({
224
				'repoId' : $scope.repo.origId,
225
				'iface'  : JSON.stringify($scope.api)
226
			})).success(function(res) {
227
	            	if(res) {
228
	            		$scope.showNotification('The API has been registered');
229
	            		location.href = 'repoApis.do#/api/' + $scope.repo.id + '/' + $scope.api.id + '/ALL/ALL'
230
	            	} else {
231
	                	$scope.hideSpinner();
232
	            		$scope.showError('Registration failed');
233
	            	}
234
			}).error(function(message) {
235
				$scope.hideSpinner();
236
				$scope.showError('Registration failed: ' + message);
237
			});
238
		}
237 239
	}
238 240
	
239 241
	$scope.resetForm();

Also available in: Unified diff