diff options
author | 2022-07-07 09:31:50 +0200 | |
---|---|---|
committer | 2022-07-07 09:31:50 +0200 | |
commit | 71c52373f81cace664047edd19d9d289f45a4dff (patch) | |
tree | 69b3f1d45a8b3f1ceab9497ea3c96e9dc18e3166 /src/stores/FeaturesStore.ts | |
parent | 6.0.0-nightly.91 [skip ci] (diff) | |
download | ferdium-app-71c5237.tar.gz ferdium-app-71c5237.tar.zst ferdium-app-71c5237.zip |
chore: Mobx & React-Router upgrade (#406)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/stores/FeaturesStore.ts')
-rw-r--r-- | src/stores/FeaturesStore.ts | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/stores/FeaturesStore.ts b/src/stores/FeaturesStore.ts index b63c252df..ed0c6c17b 100644 --- a/src/stores/FeaturesStore.ts +++ b/src/stores/FeaturesStore.ts | |||
@@ -1,5 +1,14 @@ | |||
1 | import { computed, observable, runInAction } from 'mobx'; | 1 | import { |
2 | action, | ||
3 | computed, | ||
4 | makeObservable, | ||
5 | observable, | ||
6 | runInAction, | ||
7 | } from 'mobx'; | ||
2 | 8 | ||
9 | import { Stores } from '../@types/stores.types'; | ||
10 | import { ApiInterface } from '../api'; | ||
11 | import { Actions } from '../actions/lib/actions'; | ||
3 | import CachedRequest from './lib/CachedRequest'; | 12 | import CachedRequest from './lib/CachedRequest'; |
4 | import serviceProxy from '../features/serviceProxy'; | 13 | import serviceProxy from '../features/serviceProxy'; |
5 | import basicAuth from '../features/basicAuth'; | 14 | import basicAuth from '../features/basicAuth'; |
@@ -24,6 +33,12 @@ export default class FeaturesStore extends TypedStore { | |||
24 | 33 | ||
25 | @observable features = {}; | 34 | @observable features = {}; |
26 | 35 | ||
36 | constructor(stores: Stores, api: ApiInterface, actions: Actions) { | ||
37 | super(stores, api, actions); | ||
38 | |||
39 | makeObservable(this); | ||
40 | } | ||
41 | |||
27 | async setup(): Promise<void> { | 42 | async setup(): Promise<void> { |
28 | this.registerReactions([ | 43 | this.registerReactions([ |
29 | this._updateFeatures, | 44 | this._updateFeatures, |
@@ -49,9 +64,11 @@ export default class FeaturesStore extends TypedStore { | |||
49 | } | 64 | } |
50 | Object.assign(features, requestResult); | 65 | Object.assign(features, requestResult); |
51 | } | 66 | } |
52 | runInAction('FeaturesStore::_updateFeatures', () => { | 67 | runInAction( |
53 | this.features = features; | 68 | action('FeaturesStore::_updateFeatures', () => { |
54 | }); | 69 | this.features = features; |
70 | }), | ||
71 | ); | ||
55 | }; | 72 | }; |
56 | 73 | ||
57 | _monitorLoginStatus(): void { | 74 | _monitorLoginStatus(): void { |