|
|
@@ -8,6 +8,8 @@ function (angular) {
|
|
|
|
|
|
module.controller('ProfileCtrl', function($scope, $http, backendSrv) {
|
|
|
|
|
|
+ $scope.newAccount = {name: ''};
|
|
|
+
|
|
|
$scope.init = function() {
|
|
|
$scope.getUser();
|
|
|
$scope.getUserAccounts();
|
|
|
@@ -26,11 +28,7 @@ function (angular) {
|
|
|
};
|
|
|
|
|
|
$scope.setUsingAccount = function(account) {
|
|
|
- backendSrv.request({
|
|
|
- method: 'POST',
|
|
|
- url: '/api/user/using/' + account.accountId,
|
|
|
- desc: 'Change active account',
|
|
|
- }).then($scope.getUserAccounts);
|
|
|
+ backendSrv.post('/api/user/using/' + account.accountId).then($scope.getUserAccounts);
|
|
|
};
|
|
|
|
|
|
$scope.update = function() {
|
|
|
@@ -39,6 +37,10 @@ function (angular) {
|
|
|
backendSrv.post('/api/user/', $scope.user);
|
|
|
};
|
|
|
|
|
|
+ $scope.createAccount = function() {
|
|
|
+ backendSrv.put('/api/account/', $scope.newAccount).then($scope.getUserAccounts);
|
|
|
+ };
|
|
|
+
|
|
|
$scope.init();
|
|
|
|
|
|
});
|