aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/FeaturesStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/FeaturesStore.js')
-rw-r--r--src/stores/FeaturesStore.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/stores/FeaturesStore.js b/src/stores/FeaturesStore.js
index 2a0713b6f..0adee6adf 100644
--- a/src/stores/FeaturesStore.js
+++ b/src/stores/FeaturesStore.js
@@ -1,4 +1,4 @@
1import { computed, observable } from 'mobx'; 1import { computed, observable, reaction } from 'mobx';
2 2
3import Store from './lib/Store'; 3import Store from './lib/Store';
4import CachedRequest from './lib/CachedRequest'; 4import CachedRequest from './lib/CachedRequest';
@@ -6,6 +6,7 @@ import CachedRequest from './lib/CachedRequest';
6import delayApp from '../features/delayApp'; 6import delayApp from '../features/delayApp';
7import spellchecker from '../features/spellchecker'; 7import spellchecker from '../features/spellchecker';
8import serviceProxy from '../features/serviceProxy'; 8import serviceProxy from '../features/serviceProxy';
9import basicAuth from '../features/basicAuth';
9 10
10import { DEFAULT_FEATURES_CONFIG } from '../config'; 11import { DEFAULT_FEATURES_CONFIG } from '../config';
11 12
@@ -21,6 +22,13 @@ export default class FeaturesStore extends Store {
21 22
22 await this.featuresRequest._promise; 23 await this.featuresRequest._promise;
23 setTimeout(this._enableFeatures.bind(this), 1); 24 setTimeout(this._enableFeatures.bind(this), 1);
25
26 // single key reaction
27 reaction(() => this.stores.user.data.isPremium, () => {
28 if (this.stores.user.isLoggedIn) {
29 this.featuresRequest.invalidate({ immediately: true });
30 }
31 });
24 } 32 }
25 33
26 @computed get anonymousFeatures() { 34 @computed get anonymousFeatures() {
@@ -47,5 +55,6 @@ export default class FeaturesStore extends Store {
47 delayApp(this.stores, this.actions); 55 delayApp(this.stores, this.actions);
48 spellchecker(this.stores, this.actions); 56 spellchecker(this.stores, this.actions);
49 serviceProxy(this.stores, this.actions); 57 serviceProxy(this.stores, this.actions);
58 basicAuth(this.stores, this.actions);
50 } 59 }
51} 60}