maatma: implement associated domains
This commit is contained in:
parent
955e263d39
commit
5f83c5cd2c
3 changed files with 161 additions and 12 deletions
|
@ -155,5 +155,51 @@ angular.module("AdLinApp")
|
|||
})
|
||||
|
||||
.controller("DomainsController", function($scope, $http, $interval) {
|
||||
$scope.updateAssociationD = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/adomains/",
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
$scope.adomains = [];
|
||||
response.data.forEach(function(domain) {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/adomains/" + domain,
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
response.data.forEach(function(rr) {
|
||||
$scope.adomains.push(rr);
|
||||
|
||||
});
|
||||
});
|
||||
}, function(response) {
|
||||
alert(response.data.errmsg);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateAssociationD();
|
||||
|
||||
$scope.newAssociationD = function() {
|
||||
$scope.pleaseWaitNewAssociation = true;
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "/api/adomains/",
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
$scope.updateAssociationD();
|
||||
$scope.pleaseWaitNewAssociation = false;
|
||||
}, function(response) {
|
||||
alert(response.data.errmsg);
|
||||
$scope.pleaseWaitNewAssociation = false;
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
|
|
Reference in a new issue