1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-29 06:33:40 +00:00
Files
browser/src/popup/app/settings/settingsEnvironmentController.js
2017-09-04 12:09:11 -04:00

35 lines
1.3 KiB
JavaScript

angular
.module('bit.settings')
.controller('settingsEnvironmentController', function ($scope, i18nService, $analytics, utilsService,
environmentService, toastr, $timeout) {
$scope.i18n = i18nService;
utilsService.initListSectionItemListeners($(document), angular);
$scope.baseUrl = environmentService.baseUrl || '';
$scope.webVaultUrl = environmentService.webVaultUrl || '';
$scope.apiUrl = environmentService.apiUrl || '';
$scope.identityUrl = environmentService.identityUrl || '';
$scope.save = function () {
environmentService.setUrls({
base: $scope.baseUrl,
api: $scope.apiUrl,
identity: $scope.identityUrl,
webVault: $scope.webVaultUrl
}, function (resUrls) {
$timeout(function () {
// re-set urls since service can change them, ex: prefixing https://
$scope.baseUrl = resUrls.base;
$scope.apiUrl = resUrls.api;
$scope.identityUrl = resUrls.identity;
$scope.webVaultUrl = resUrls.webVault;
$analytics.eventTrack('Set Environment URLs');
toastr.success(i18nService.environmentSaved);
});
});
};
});