Skip to content

Commit

Permalink
Fix toggleExtension function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Ángel González authored and Jesús Ángel committed Jun 20, 2018
1 parent 0df81fa commit bb0c096
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions public/controllers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,17 @@ app.controller('settingsController', function ($scope, $rootScope, $http, $route
};

// Toggle extension
$scope.toggleExtension = async (extension, state) => {
getCurrentAPIIndex()
if ($scope.apiEntries && $scope.apiEntries.length && ['oscap','audit','pci','gdpr','aws','virustotal'].includes(extension)) {
$scope.apiEntries[currentApiEntryIndex]._source.extensions[extension] = state;
appState.setExtensions($scope.apiEntries[currentApiEntryIndex]._id,$scope.apiEntries[currentApiEntryIndex]._source.extensions);

$scope.toggleExtension = (extension, state) => {
try{
const api = JSON.parse(appState.getCurrentAPI()).id
const currentExtensions = appState.getExtensions(api);
currentExtensions[extension] = state;
appState.setExtensions(api,currentExtensions)
getCurrentAPIIndex()
$scope.apiEntries[currentApiEntryIndex]._source.extensions = currentExtensions;
if(!$scope.$$phase) $scope.$digest();
} catch (error) {
errorHandler.handle(error, 'Settings')
}
};

Expand Down

0 comments on commit bb0c096

Please sign in to comment.