Skip to content

Commit bb33486

Browse files
committed
Retain user config changes across multiple sessions
1 parent 3f8471b commit bb33486

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

app/public/js/settings/settingsCtrl.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ app.controller('SettingsCtrl', function ($scope, notificationFactory) {
1919

2020
$scope.scClientId = function () {
2121
window.localStorage.scClientId = $scope.client_id;
22+
window.settings.updateUserConfig();
2223
};
2324

2425
/**

app/public/js/system/settings.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const ua = require('universal-analytics');
44
const configuration = require('../common/configLocation');
55
const userConfig = configuration.getConfigfile();
6+
const fs = require('fs-extra');
67

78
// Set up some core settings
89
window.settings = {};
@@ -18,3 +19,10 @@ window.scAccessToken = userConfig.accessToken;
1819

1920
// set window clientId
2021
window.localStorage.setItem('scClientId', userConfig.clientId);
22+
23+
window.settings.updateUserConfig = function () {
24+
fs.writeFileSync(configuration.getPath(), JSON.stringify({
25+
accessToken: userConfig.accessToken,
26+
clientId: window.localStorage.scClientId
27+
}), 'utf-8');
28+
}

0 commit comments

Comments
 (0)