diff options
author | 2021-11-18 17:37:45 +0100 | |
---|---|---|
committer | 2021-11-18 22:07:45 +0530 | |
commit | b37a6b07b39c8c7827052dc6fb97f490f1e0f514 (patch) | |
tree | 0276e7c51f5ebfa14c566def7aac39f014c2291d /docs/example-feature/store.js | |
parent | Update github issues template [skip ci] (diff) | |
download | ferdium-app-b37a6b07b39c8c7827052dc6fb97f490f1e0f514.tar.gz ferdium-app-b37a6b07b39c8c7827052dc6fb97f490f1e0f514.tar.zst ferdium-app-b37a6b07b39c8c7827052dc6fb97f490f1e0f514.zip |
chore: convert various files to TS (#2246)
* convert various files to TS
* removed outdated docs/example-feature folder
* turn off unicorn/no-empty-file
* update eslint config
Diffstat (limited to 'docs/example-feature/store.js')
-rw-r--r-- | docs/example-feature/store.js | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/docs/example-feature/store.js b/docs/example-feature/store.js deleted file mode 100644 index 9fc86de36..000000000 --- a/docs/example-feature/store.js +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | import { action, observable, reaction } from 'mobx'; | ||
2 | import Store from '../../src/stores/lib/Store'; | ||
3 | import Request from '../../src/stores/lib/Request'; | ||
4 | |||
5 | const debug = require('debug')('Ferdi:feature:EXAMPLE_FEATURE:store'); | ||
6 | |||
7 | export class ExampleFeatureStore extends Store { | ||
8 | @observable getNameRequest = new Request(this.api, 'getName'); | ||
9 | |||
10 | constructor(stores, api, actions, state) { | ||
11 | super(stores, api, actions); | ||
12 | this.state = state; | ||
13 | } | ||
14 | |||
15 | setup() { | ||
16 | debug('fetching name from api'); | ||
17 | this.getNameRequest.execute(); | ||
18 | |||
19 | // Update the name on the state when the request resolved | ||
20 | reaction( | ||
21 | () => ( | ||
22 | this.getNameRequest.result | ||
23 | ), | ||
24 | (name) => { | ||
25 | this._setName(name); | ||
26 | }, | ||
27 | ); | ||
28 | } | ||
29 | |||
30 | @action _setName = (name) => { | ||
31 | debug('setting name', name); | ||
32 | this.state.name = name; | ||
33 | }; | ||
34 | } | ||
35 | |||
36 | export default ExampleFeatureStore; | ||