fix vhuser in function

This commit is contained in:
usmannasir
2025-04-04 18:50:03 +05:00
parent 182af8090a
commit 64ddabeac4

View File

@@ -2677,35 +2677,27 @@ app.controller('listWebsites', function ($scope, $http, $window) {
$scope.showWPSites = function(domain) { $scope.showWPSites = function(domain) {
var url = '/websites/fetchWPDetails'; var url = '/websites/fetchWPDetails';
var data = { var data = {
domain: domain domain: domain
}; };
$http({ $http({
method: 'POST', method: 'POST',
url: url, url: url,
data: $.param(data), data: $.param(data),
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
'X-CSRFToken': getCookie('csrftoken') 'X-CSRFToken': getCookie('csrftoken')
} }
}).then(function(response) { }).then(function(response) {
if (response.data.status === 1) { if (response.data.status === 1) {
var sites = response.data.sites; $scope.web.wp_sites = response.data.sites;
var message = 'WordPress Sites for ' + domain + ':\n\n'; $scope.web.showWPSites = true;
sites.forEach(function(site) { } else {
message += 'Title: ' + site.title + '\n'; alert('Error: ' + response.data.error_message);
message += 'URL: ' + site.url + '\n'; }
message += 'Version: ' + site.version + '\n';
message += 'Status: ' + site.status + '\n\n';
});
alert(message);
} else {
alert('Error: ' + response.data.error_message);
}
}).catch(function(error) { }).catch(function(error) {
alert('Error fetching WordPress sites: ' + JSON.stringify(error)); alert('Error fetching WordPress sites: ' + JSON.stringify(error));
}); });
}; };
$scope.visitSite = function(url) { $scope.visitSite = function(url) {
window.open(url, '_blank'); window.open(url, '_blank');