diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-02-22 13:04:51 +0100 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-02-22 13:04:51 +0100 |
commit | 3de31efa29b8f2729f968d9d63c42d21c7d8dcf5 (patch) | |
tree | 69553d661c7485493edfdd91e080a9dc06f51f0f /src/features/workspaces/store.js | |
parent | small fixes (diff) | |
download | ferdium-app-3de31efa29b8f2729f968d9d63c42d21c7d8dcf5.tar.gz ferdium-app-3de31efa29b8f2729f968d9d63c42d21c7d8dcf5.tar.zst ferdium-app-3de31efa29b8f2729f968d9d63c42d21c7d8dcf5.zip |
adds flow for deleting workspaces
Diffstat (limited to 'src/features/workspaces/store.js')
-rw-r--r-- | src/features/workspaces/store.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index d90f9caac..a9b93f904 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -50,6 +50,7 @@ export default class WorkspacesStore extends Store { | |||
50 | 50 | ||
51 | this.actions.workspace.edit.listen(this._edit); | 51 | this.actions.workspace.edit.listen(this._edit); |
52 | this.actions.workspace.create.listen(this._create); | 52 | this.actions.workspace.create.listen(this._create); |
53 | this.actions.workspace.delete.listen(this._delete); | ||
53 | } | 54 | } |
54 | 55 | ||
55 | _setWorkspaces = (workspaces) => { | 56 | _setWorkspaces = (workspaces) => { |
@@ -77,4 +78,14 @@ export default class WorkspacesStore extends Store { | |||
77 | throw error; | 78 | throw error; |
78 | } | 79 | } |
79 | }; | 80 | }; |
81 | |||
82 | _delete = async ({ workspace }) => { | ||
83 | try { | ||
84 | await this.api.deleteWorkspace(workspace); | ||
85 | this.state.workspaces.remove(workspace); | ||
86 | this.stores.router.push('/settings/workspaces'); | ||
87 | } catch (error) { | ||
88 | throw error; | ||
89 | } | ||
90 | }; | ||
80 | } | 91 | } |