diff options
author | 2019-06-06 14:02:05 +0200 | |
---|---|---|
committer | 2019-06-06 14:02:05 +0200 | |
commit | a377c278727155c3748bfcb7f478a258852cf043 (patch) | |
tree | caab97f3e589ab241ab02ca4cd5a8e4c6ea887ad | |
parent | Update package-lock.json (diff) | |
download | ferdium-app-a377c278727155c3748bfcb7f478a258852cf043.tar.gz ferdium-app-a377c278727155c3748bfcb7f478a258852cf043.tar.zst ferdium-app-a377c278727155c3748bfcb7f478a258852cf043.zip |
reset news request when user logs out
-rw-r--r-- | src/stores/NewsStore.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stores/NewsStore.js b/src/stores/NewsStore.js index 6984425df..86e092592 100644 --- a/src/stores/NewsStore.js +++ b/src/stores/NewsStore.js | |||
@@ -16,6 +16,7 @@ export default class NewsStore extends Store { | |||
16 | 16 | ||
17 | // Register action handlers | 17 | // Register action handlers |
18 | this.actions.news.hide.listen(this._hide.bind(this)); | 18 | this.actions.news.hide.listen(this._hide.bind(this)); |
19 | this.actions.user.logout.listen(this._resetNewsRequest.bind(this)); | ||
19 | } | 20 | } |
20 | 21 | ||
21 | setup() { | 22 | setup() { |
@@ -40,4 +41,15 @@ export default class NewsStore extends Store { | |||
40 | remove(result, n => n.id === newsId); | 41 | remove(result, n => n.id === newsId); |
41 | }); | 42 | }); |
42 | } | 43 | } |
44 | |||
45 | /** | ||
46 | * Reset the news request when current user logs out so that when another user | ||
47 | * logs in again without an app restart, the request will be fetched again and | ||
48 | * the news will be shown to the user. | ||
49 | * | ||
50 | * @private | ||
51 | */ | ||
52 | _resetNewsRequest() { | ||
53 | this.latestNewsRequest.reset(); | ||
54 | } | ||
43 | } | 55 | } |