diff options
author | 2019-06-12 11:35:22 +0200 | |
---|---|---|
committer | 2019-06-12 11:35:22 +0200 | |
commit | 98910182bb1316c02865bebe2e4e3a00fbba3f0a (patch) | |
tree | 1546e5a602b4b1c39df102459d11c4c1d4893036 /src/stores | |
parent | Update CHANGELOG.md (diff) | |
parent | Update CHANGELOG.md (diff) | |
download | ferdium-app-98910182bb1316c02865bebe2e4e3a00fbba3f0a.tar.gz ferdium-app-98910182bb1316c02865bebe2e4e3a00fbba3f0a.tar.zst ferdium-app-98910182bb1316c02865bebe2e4e3a00fbba3f0a.zip |
Merge pull request #1472 from meetfranz/release/5.2.0-beta.1
5.2.0 beta.1
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/GlobalErrorStore.js | 7 | ||||
-rw-r--r-- | src/stores/NewsStore.js | 12 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 14 | ||||
-rw-r--r-- | src/stores/UserStore.js | 3 |
4 files changed, 30 insertions, 6 deletions
diff --git a/src/stores/GlobalErrorStore.js b/src/stores/GlobalErrorStore.js index 90bf751c3..7a85c2daa 100644 --- a/src/stores/GlobalErrorStore.js +++ b/src/stores/GlobalErrorStore.js | |||
@@ -18,8 +18,11 @@ export default class GlobalErrorStore extends Store { | |||
18 | this.error = request.error; | 18 | this.error = request.error; |
19 | 19 | ||
20 | if (request.error.json) { | 20 | if (request.error.json) { |
21 | this.response = await request.error.json(); | 21 | try { |
22 | 22 | this.response = await request.error.json(); | |
23 | } catch (error) { | ||
24 | this.response = {}; | ||
25 | } | ||
23 | if (this.error.status === 401) { | 26 | if (this.error.status === 401) { |
24 | this.actions.user.logout({ serverLogout: true }); | 27 | this.actions.user.logout({ serverLogout: true }); |
25 | } | 28 | } |
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 | } |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 13f929c2f..d63302fce 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -291,7 +291,8 @@ export default class ServicesStore extends Store { | |||
291 | gaEvent('Service', 'clear cache'); | 291 | gaEvent('Service', 'clear cache'); |
292 | } | 292 | } |
293 | 293 | ||
294 | @action _setActive({ serviceId }) { | 294 | @action _setActive({ serviceId, keepActiveRoute }) { |
295 | if (!keepActiveRoute) this.stores.router.push('/'); | ||
295 | const service = this.one(serviceId); | 296 | const service = this.one(serviceId); |
296 | 297 | ||
297 | this.all.forEach((s, index) => { | 298 | this.all.forEach((s, index) => { |
@@ -517,7 +518,16 @@ export default class ServicesStore extends Store { | |||
517 | this.actions.ui.toggleServiceUpdatedInfoBar({ visible: false }); | 518 | this.actions.ui.toggleServiceUpdatedInfoBar({ visible: false }); |
518 | } | 519 | } |
519 | 520 | ||
520 | @action _reorder({ oldIndex, newIndex }) { | 521 | @action _reorder(params) { |
522 | const { workspaces } = this.stores; | ||
523 | if (workspaces.isAnyWorkspaceActive) { | ||
524 | workspaces.reorderServicesOfActiveWorkspace(params); | ||
525 | } else { | ||
526 | this._reorderService(params); | ||
527 | } | ||
528 | } | ||
529 | |||
530 | @action _reorderService({ oldIndex, newIndex }) { | ||
521 | const showDisabledServices = this.stores.settings.all.app.showDisabledServices; | 531 | const showDisabledServices = this.stores.settings.all.app.showDisabledServices; |
522 | const oldEnabledSortIndex = showDisabledServices ? oldIndex : this.all.indexOf(this.enabled[oldIndex]); | 532 | const oldEnabledSortIndex = showDisabledServices ? oldIndex : this.all.indexOf(this.enabled[oldIndex]); |
523 | const newEnabledSortIndex = showDisabledServices ? newIndex : this.all.indexOf(this.enabled[newIndex]); | 533 | const newEnabledSortIndex = showDisabledServices ? newIndex : this.all.indexOf(this.enabled[newIndex]); |
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js index 31555dd5c..b5423af3b 100644 --- a/src/stores/UserStore.js +++ b/src/stores/UserStore.js | |||
@@ -329,8 +329,7 @@ export default class UserStore extends Store { | |||
329 | authToken, | 329 | authToken, |
330 | }); | 330 | }); |
331 | } catch (err) { | 331 | } catch (err) { |
332 | console.error('AccessToken Invalid'); | 332 | this._logout(); |
333 | |||
334 | return false; | 333 | return false; |
335 | } | 334 | } |
336 | } | 335 | } |