From a377c278727155c3748bfcb7f478a258852cf043 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Thu, 6 Jun 2019 14:02:05 +0200 Subject: reset news request when user logs out --- src/stores/NewsStore.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/stores') 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 { // Register action handlers this.actions.news.hide.listen(this._hide.bind(this)); + this.actions.user.logout.listen(this._resetNewsRequest.bind(this)); } setup() { @@ -40,4 +41,15 @@ export default class NewsStore extends Store { remove(result, n => n.id === newsId); }); } + + /** + * Reset the news request when current user logs out so that when another user + * logs in again without an app restart, the request will be fetched again and + * the news will be shown to the user. + * + * @private + */ + _resetNewsRequest() { + this.latestNewsRequest.reset(); + } } -- cgit v1.2.3-70-g09d2