diff options
author | 2019-03-23 14:20:58 +0100 | |
---|---|---|
committer | 2019-03-23 14:21:14 +0100 | |
commit | 90d43824750435aad29a73c8956736cf88c3c15c (patch) | |
tree | 3b7f6c2b04de22103a62005bdf35387fb6c36629 /src/features | |
parent | refactor state management for workspace feature (diff) | |
download | ferdium-app-90d43824750435aad29a73c8956736cf88c3c15c.tar.gz ferdium-app-90d43824750435aad29a73c8956736cf88c3c15c.tar.zst ferdium-app-90d43824750435aad29a73c8956736cf88c3c15c.zip |
reset api requests when workspace feature is stopped
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/workspaces/api.js | 7 | ||||
-rw-r--r-- | src/features/workspaces/index.js | 2 | ||||
-rw-r--r-- | src/features/workspaces/store.js | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/features/workspaces/api.js b/src/features/workspaces/api.js index 4e076d233..634f9f989 100644 --- a/src/features/workspaces/api.js +++ b/src/features/workspaces/api.js | |||
@@ -58,3 +58,10 @@ export const getUserWorkspacesRequest = new CachedRequest(workspaceApi, 'getUser | |||
58 | export const createWorkspaceRequest = new Request(workspaceApi, 'createWorkspace'); | 58 | export const createWorkspaceRequest = new Request(workspaceApi, 'createWorkspace'); |
59 | export const deleteWorkspaceRequest = new Request(workspaceApi, 'deleteWorkspace'); | 59 | export const deleteWorkspaceRequest = new Request(workspaceApi, 'deleteWorkspace'); |
60 | export const updateWorkspaceRequest = new Request(workspaceApi, 'updateWorkspace'); | 60 | export const updateWorkspaceRequest = new Request(workspaceApi, 'updateWorkspace'); |
61 | |||
62 | export const resetApiRequests = () => { | ||
63 | getUserWorkspacesRequest.reset(); | ||
64 | createWorkspaceRequest.reset(); | ||
65 | deleteWorkspaceRequest.reset(); | ||
66 | updateWorkspaceRequest.reset(); | ||
67 | }; | ||
diff --git a/src/features/workspaces/index.js b/src/features/workspaces/index.js index 68f82bdee..0d30cd19d 100644 --- a/src/features/workspaces/index.js +++ b/src/features/workspaces/index.js | |||
@@ -1,5 +1,6 @@ | |||
1 | import { reaction } from 'mobx'; | 1 | import { reaction } from 'mobx'; |
2 | import WorkspacesStore from './store'; | 2 | import WorkspacesStore from './store'; |
3 | import { resetApiRequests } from './api'; | ||
3 | 4 | ||
4 | const debug = require('debug')('Franz:feature:workspaces'); | 5 | const debug = require('debug')('Franz:feature:workspaces'); |
5 | 6 | ||
@@ -22,6 +23,7 @@ export default function initWorkspaces(stores, actions) { | |||
22 | } else if (workspaceStore.isFeatureActive) { | 23 | } else if (workspaceStore.isFeatureActive) { |
23 | debug('Disabling `workspaces` feature'); | 24 | debug('Disabling `workspaces` feature'); |
24 | workspaceStore.stop(); | 25 | workspaceStore.stop(); |
26 | resetApiRequests(); | ||
25 | } | 27 | } |
26 | }, | 28 | }, |
27 | { | 29 | { |
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index 883f36ffb..dbb1d7b05 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -29,6 +29,7 @@ export default class WorkspacesStore { | |||
29 | @observable isWorkspaceDrawerOpen = false; | 29 | @observable isWorkspaceDrawerOpen = false; |
30 | 30 | ||
31 | @computed get workspaces() { | 31 | @computed get workspaces() { |
32 | if (!this.isFeatureActive) return []; | ||
32 | return getUserWorkspacesRequest.execute().result || []; | 33 | return getUserWorkspacesRequest.execute().result || []; |
33 | } | 34 | } |
34 | 35 | ||