From 8d09ead303a2d17a644958804d3c0ad65b86fbf7 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 6 Apr 2025 21:32:16 +0500 Subject: [PATCH] move modal inside controller --- .../websiteFunctions/websiteFunctions.js | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 266df50d6..b408ece8c 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -3122,20 +3122,14 @@ app.controller('listWebsites', function ($scope, $http, $window) { var config = { headers: { 'X-CSRFToken': getCookie('csrftoken'), - 'Content-Type': 'application/x-www-form-urlencoded' - }, - transformRequest: function(obj) { - var str = []; - for(var p in obj) - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); - return str.join("&"); + 'Content-Type': 'application/json' } }; console.log('Sending request to /websites/UpdateWPSettings'); $('#passwordProtectionModal').modal('hide'); - $http.post('/websites/UpdateWPSettings', data, config).then(function(response) { + $http.post('/websites/UpdateWPSettings', JSON.stringify(data), config).then(function(response) { console.log('Received response:', response); if (response.data.status === 1) { console.log('Password protection updated successfully'); @@ -6524,20 +6518,14 @@ $scope.submitPasswordProtection = function() { var config = { headers: { 'X-CSRFToken': getCookie('csrftoken'), - 'Content-Type': 'application/x-www-form-urlencoded' - }, - transformRequest: function(obj) { - var str = []; - for(var p in obj) - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); - return str.join("&"); + 'Content-Type': 'application/json' } }; console.log('Sending request to /websites/UpdateWPSettings'); $('#passwordProtectionModal').modal('hide'); - $http.post('/websites/UpdateWPSettings', data, config).then(function(response) { + $http.post('/websites/UpdateWPSettings', JSON.stringify(data), config).then(function(response) { console.log('Received response:', response); if (response.data.status === 1) { console.log('Password protection updated successfully');