diff options
Diffstat (limited to 'src/stores/FeaturesStore.js')
-rw-r--r-- | src/stores/FeaturesStore.js | 11 |
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 @@ | |||
1 | import { computed, observable } from 'mobx'; | 1 | import { computed, observable, reaction } from 'mobx'; |
2 | 2 | ||
3 | import Store from './lib/Store'; | 3 | import Store from './lib/Store'; |
4 | import CachedRequest from './lib/CachedRequest'; | 4 | import CachedRequest from './lib/CachedRequest'; |
@@ -6,6 +6,7 @@ import CachedRequest from './lib/CachedRequest'; | |||
6 | import delayApp from '../features/delayApp'; | 6 | import delayApp from '../features/delayApp'; |
7 | import spellchecker from '../features/spellchecker'; | 7 | import spellchecker from '../features/spellchecker'; |
8 | import serviceProxy from '../features/serviceProxy'; | 8 | import serviceProxy from '../features/serviceProxy'; |
9 | import basicAuth from '../features/basicAuth'; | ||
9 | 10 | ||
10 | import { DEFAULT_FEATURES_CONFIG } from '../config'; | 11 | import { 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 | } |