diff options
Diffstat (limited to 'src/stores/AppStore.js')
-rw-r--r-- | src/stores/AppStore.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index f102fc370..329c43f32 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -81,6 +81,8 @@ export default class AppStore extends Store { | |||
81 | 81 | ||
82 | dictionaries = []; | 82 | dictionaries = []; |
83 | 83 | ||
84 | fetchDataInterval = null; | ||
85 | |||
84 | constructor(...args) { | 86 | constructor(...args) { |
85 | super(...args); | 87 | super(...args); |
86 | 88 | ||
@@ -102,6 +104,7 @@ export default class AppStore extends Store { | |||
102 | this._setLocale.bind(this), | 104 | this._setLocale.bind(this), |
103 | this._muteAppHandler.bind(this), | 105 | this._muteAppHandler.bind(this), |
104 | this._handleFullScreen.bind(this), | 106 | this._handleFullScreen.bind(this), |
107 | this._handleLogout.bind(this), | ||
105 | ]); | 108 | ]); |
106 | } | 109 | } |
107 | 110 | ||
@@ -129,6 +132,11 @@ export default class AppStore extends Store { | |||
129 | this._systemDND(); | 132 | this._systemDND(); |
130 | setInterval(() => this._systemDND(), ms('5s')); | 133 | setInterval(() => this._systemDND(), ms('5s')); |
131 | 134 | ||
135 | this.fetchDataInterval = setInterval(() => { | ||
136 | this.stores.user.getUserInfoRequest.invalidate({ immediately: true }); | ||
137 | this.stores.features.featuresRequest.invalidate({ immediately: true }); | ||
138 | }, ms('10s')); | ||
139 | |||
132 | // Check for updates once every 4 hours | 140 | // Check for updates once every 4 hours |
133 | setInterval(() => this._checkForUpdates(), CHECK_INTERVAL); | 141 | setInterval(() => this._checkForUpdates(), CHECK_INTERVAL); |
134 | // Check for an update in 30s (need a delay to prevent Squirrel Installer lock file issues) | 142 | // Check for an update in 30s (need a delay to prevent Squirrel Installer lock file issues) |
@@ -430,6 +438,12 @@ export default class AppStore extends Store { | |||
430 | } | 438 | } |
431 | } | 439 | } |
432 | 440 | ||
441 | _handleLogout() { | ||
442 | if (!this.stores.user.isLoggedIn) { | ||
443 | clearInterval(this.fetchDataInterval); | ||
444 | } | ||
445 | } | ||
446 | |||
433 | // Helpers | 447 | // Helpers |
434 | _appStartsCounter() { | 448 | _appStartsCounter() { |
435 | this.actions.settings.update({ | 449 | this.actions.settings.update({ |