diff options
author | 2018-02-27 13:41:34 +0100 | |
---|---|---|
committer | 2018-02-27 13:41:34 +0100 | |
commit | b6bda41e25e06dfb590753c8fe19f8cc1930d0c1 (patch) | |
tree | 2a6c4373e5080f8c4a7d97b5b1be8f733b52e2d8 /src | |
parent | ADD `features` request (diff) | |
download | ferdium-app-b6bda41e25e06dfb590753c8fe19f8cc1930d0c1.tar.gz ferdium-app-b6bda41e25e06dfb590753c8fe19f8cc1930d0c1.tar.zst ferdium-app-b6bda41e25e06dfb590753c8fe19f8cc1930d0c1.zip |
REMOVE `base` getter
Diffstat (limited to 'src')
-rw-r--r-- | src/stores/FeaturesStore.js | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/stores/FeaturesStore.js b/src/stores/FeaturesStore.js index 817c2273f..a315d3b46 100644 --- a/src/stores/FeaturesStore.js +++ b/src/stores/FeaturesStore.js | |||
@@ -1,10 +1,9 @@ | |||
1 | import { action, computed, observable } from 'mobx'; | 1 | import { computed, observable } 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'; |
5 | import Request from './lib/Request'; | ||
6 | 5 | ||
7 | export default class RecipesStore extends Store { | 6 | export default class FeaturesStore extends Store { |
8 | @observable baseFeaturesRequest = new CachedRequest(this.api.features, 'base'); | 7 | @observable baseFeaturesRequest = new CachedRequest(this.api.features, 'base'); |
9 | @observable featuresRequest = new CachedRequest(this.api.features, 'features'); | 8 | @observable featuresRequest = new CachedRequest(this.api.features, 'features'); |
10 | 9 | ||
@@ -15,29 +14,23 @@ export default class RecipesStore extends Store { | |||
15 | ]); | 14 | ]); |
16 | } | 15 | } |
17 | 16 | ||
18 | @computed get base() { | ||
19 | return this.baseFeaturesRequest.execute().result || {}; | ||
20 | } | ||
21 | |||
22 | @computed get features() { | 17 | @computed get features() { |
23 | if (this.stores.user.isLoggedIn) { | 18 | if (this.stores.user.isLoggedIn) { |
24 | return this.featuresRequest.execute().result || {}; | 19 | return this.featuresRequest.execute().result || {}; |
25 | } | 20 | } |
26 | 21 | ||
27 | return this.base; | 22 | return this.baseFeaturesRequest.execute().result || {}; |
28 | } | 23 | } |
29 | 24 | ||
30 | _debugFeatures() { | 25 | _debugFeatures() { |
31 | console.log(this.base, this.features) | 26 | console.log(this.features); |
32 | } | 27 | } |
33 | 28 | ||
34 | _monitorLoginStatus() { | 29 | _monitorLoginStatus() { |
35 | if (this.stores.user.isLoggedIn) { | 30 | if (this.stores.user.isLoggedIn) { |
36 | this.featuresRequest.invalidate({ immediately: true }); | 31 | this.featuresRequest.invalidate({ immediately: true }); |
37 | this.featuresRequest.execute(); | ||
38 | } else { | 32 | } else { |
39 | this.baseFeaturesRequest.invalidate({ immediately: true }); | 33 | this.baseFeaturesRequest.invalidate({ immediately: true }); |
40 | this.baseFeaturesRequest.execute(); | ||
41 | } | 34 | } |
42 | } | 35 | } |
43 | } | 36 | } |