Commit ab7e2f89 by Torkel Ödegaard

Corrected the use of POST vs PUT, POST creates something, PUT updates, got them mixed up

parent 71ab8d6a
......@@ -75,7 +75,7 @@ function (angular, config) {
return;
}
backendSrv.put('/api/user/signup', $scope.formModel).then(function() {
backendSrv.post('/api/user/signup', $scope.formModel).then(function() {
window.location.href = config.appSubUrl + '/';
});
};
......
......@@ -24,22 +24,12 @@ function (angular) {
};
$scope.removeUser = function(user) {
backendSrv.request({
method: 'DELETE',
url: '/api/account/users/' + user.userId
}).then($scope.get);
backendSrv.delete('/api/account/users/' + user.userId).then($scope.get);
};
$scope.addUser = function() {
if (!$scope.form.$valid) {
return;
}
backendSrv.request({
method: 'PUT',
url: '/api/account/users',
data: $scope.user,
}).then($scope.get);
if (!$scope.form.$valid) { return; }
backendSrv.post('/api/account/users', $scope.user).then($scope.get);
};
$scope.init();
......
......@@ -26,12 +26,7 @@ function (angular) {
};
$scope.addToken = function() {
backendSrv.request({
method: 'PUT',
url: '/api/tokens',
data: $scope.token,
desc: 'Add token'
}).then($scope.getTokens);
backendSrv.post('/api/tokens', $scope.token).then($scope.getTokens);
};
$scope.init();
......
......@@ -33,12 +33,11 @@ function (angular) {
$scope.update = function() {
if (!$scope.userForm.$valid) { return; }
backendSrv.post('/api/user/', $scope.user);
backendSrv.put('/api/user/', $scope.user);
};
$scope.createAccount = function() {
backendSrv.put('/api/account/', $scope.newAccount).then($scope.getUserAccounts);
backendSrv.post('/api/account/', $scope.newAccount).then($scope.getUserAccounts);
};
$scope.init();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment