diff options
Diffstat (limited to 'src/features/workspaces/store.js')
-rw-r--r-- | src/features/workspaces/store.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index a9b93f904..5cccb2ab7 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -51,6 +51,7 @@ export default class WorkspacesStore extends Store { | |||
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 | this.actions.workspace.delete.listen(this._delete); |
54 | this.actions.workspace.update.listen(this._update); | ||
54 | } | 55 | } |
55 | 56 | ||
56 | _setWorkspaces = (workspaces) => { | 57 | _setWorkspaces = (workspaces) => { |
@@ -88,4 +89,15 @@ export default class WorkspacesStore extends Store { | |||
88 | throw error; | 89 | throw error; |
89 | } | 90 | } |
90 | }; | 91 | }; |
92 | |||
93 | _update = async ({ workspace }) => { | ||
94 | try { | ||
95 | await this.api.updateWorkspace(workspace); | ||
96 | const localWorkspace = this.state.workspaces.find(ws => ws.id === workspace.id); | ||
97 | Object.assign(localWorkspace, workspace); | ||
98 | this.stores.router.push('/settings/workspaces'); | ||
99 | } catch (error) { | ||
100 | throw error; | ||
101 | } | ||
102 | }; | ||
91 | } | 103 | } |