From dca7437b45c8eb67692a1df563fb4e969826b1cc Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Tue, 26 Feb 2019 15:29:34 +0100 Subject: finish basic workspace settings --- src/features/workspaces/store.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/features/workspaces/store.js') 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 { this.actions.workspace.edit.listen(this._edit); this.actions.workspace.create.listen(this._create); this.actions.workspace.delete.listen(this._delete); + this.actions.workspace.update.listen(this._update); } _setWorkspaces = (workspaces) => { @@ -88,4 +89,15 @@ export default class WorkspacesStore extends Store { throw error; } }; + + _update = async ({ workspace }) => { + try { + await this.api.updateWorkspace(workspace); + const localWorkspace = this.state.workspaces.find(ws => ws.id === workspace.id); + Object.assign(localWorkspace, workspace); + this.stores.router.push('/settings/workspaces'); + } catch (error) { + throw error; + } + }; } -- cgit v1.2.3-54-g00ecf