aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/FeaturesStore.js
diff options
context:
space:
mode:
authorLibravatar haraldox <hnaumann+github@gmail.com>2018-02-27 13:41:34 +0100
committerLibravatar haraldox <hnaumann+github@gmail.com>2018-02-27 13:41:34 +0100
commitb6bda41e25e06dfb590753c8fe19f8cc1930d0c1 (patch)
tree2a6c4373e5080f8c4a7d97b5b1be8f733b52e2d8 /src/stores/FeaturesStore.js
parentADD `features` request (diff)
downloadferdium-app-b6bda41e25e06dfb590753c8fe19f8cc1930d0c1.tar.gz
ferdium-app-b6bda41e25e06dfb590753c8fe19f8cc1930d0c1.tar.zst
ferdium-app-b6bda41e25e06dfb590753c8fe19f8cc1930d0c1.zip
REMOVE `base` getter
Diffstat (limited to 'src/stores/FeaturesStore.js')
-rw-r--r--src/stores/FeaturesStore.js15
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 @@
1import { action, computed, observable } from 'mobx'; 1import { computed, observable } from 'mobx';
2 2
3import Store from './lib/Store'; 3import Store from './lib/Store';
4import CachedRequest from './lib/CachedRequest'; 4import CachedRequest from './lib/CachedRequest';
5import Request from './lib/Request';
6 5
7export default class RecipesStore extends Store { 6export 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}