diff options
Diffstat (limited to 'src/stores/lib/TypedStore.ts')
-rw-r--r-- | src/stores/lib/TypedStore.ts | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/stores/lib/TypedStore.ts b/src/stores/lib/TypedStore.ts index c97ae1aa5..e44eadd32 100644 --- a/src/stores/lib/TypedStore.ts +++ b/src/stores/lib/TypedStore.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { computed, IReactionPublic, observable } from 'mobx'; | 1 | import { computed, IReactionPublic, makeObservable, observable } from 'mobx'; |
2 | import { Actions } from '../../actions/lib/actions'; | 2 | import { Actions } from '../../actions/lib/actions'; |
3 | import { ApiInterface } from '../../api'; | 3 | import { ApiInterface } from '../../api'; |
4 | import { Stores } from '../../@types/stores.types'; | 4 | import { Stores } from '../../@types/stores.types'; |
@@ -9,6 +9,12 @@ export default abstract class TypedStore { | |||
9 | 9 | ||
10 | @observable _status: any = null; | 10 | @observable _status: any = null; |
11 | 11 | ||
12 | stores: Stores; | ||
13 | |||
14 | api: ApiInterface; | ||
15 | |||
16 | actions: Actions; | ||
17 | |||
12 | @computed get actionStatus() { | 18 | @computed get actionStatus() { |
13 | return this._status || []; | 19 | return this._status || []; |
14 | } | 20 | } |
@@ -17,11 +23,13 @@ export default abstract class TypedStore { | |||
17 | this._status = status; | 23 | this._status = status; |
18 | } | 24 | } |
19 | 25 | ||
20 | constructor( | 26 | constructor(stores: Stores, api: ApiInterface, actions: Actions) { |
21 | public readonly stores: Stores, | 27 | makeObservable(this); |
22 | public readonly api: ApiInterface, | 28 | |
23 | public readonly actions: Actions, | 29 | this.stores = stores; |
24 | ) {} | 30 | this.api = api; |
31 | this.actions = actions; | ||
32 | } | ||
25 | 33 | ||
26 | registerReactions(reactions: { (r: IReactionPublic): void }[]): void { | 34 | registerReactions(reactions: { (r: IReactionPublic): void }[]): void { |
27 | for (const reaction of reactions) { | 35 | for (const reaction of reactions) { |