From f2cf861069e6494772349ef8fa16d911d31999c4 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 4 Apr 2025 21:00:38 +0500 Subject: [PATCH] fix showwpsites --- .../static/websiteFunctions/websiteFunctions.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 5c3d53e41..c01ff2160 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -2674,7 +2674,7 @@ app.controller('listWebsites', function ($scope, $http, $window) { // Call it immediately $scope.getFurtherWebsitesFromDB(); - $scope.showWPSites = function(domain) { + $scope.Sites = function(domain) { var url = '/websites/fetchWPDetails'; var data = { domain: domain @@ -2688,16 +2688,19 @@ app.controller('listWebsites', function ($scope, $http, $window) { 'X-CSRFToken': getCookie('csrftoken') } }).then(function(response) { - if (response.data.status === 1) { + if (response.data.status === 1 && response.data.fetchStatus === 1) { $scope.web.wp_sites = response.data.sites; $scope.web.showWPSites = true; + $("#listFail").hide(); } else { - alert('Error: ' + response.data.error_message); + $("#listFail").fadeIn(); + $scope.errorMessage = response.data.error_message || 'Failed to fetch WordPress sites'; } }).catch(function(error) { - alert('Error fetching WordPress sites: ' + JSON.stringify(error)); + $("#listFail").fadeIn(); + $scope.errorMessage = error.message || 'An error occurred while fetching WordPress sites'; }); - }; + }; $scope.visitSite = function(url) { window.open(url, '_blank'); @@ -6581,7 +6584,7 @@ app.controller('manageAliasController', function ($scope, $http, $timeout, $wind 'X-CSRFToken': getCookie('csrftoken') } }).then(function(response) { - if (response.data.status === 1) { + if (response.data.status === 1 && response.data.fetchStatus === 1) { var sites = response.data.sites; var message = 'WordPress Sites for ' + domain + ':\n\n'; sites.forEach(function(site) {