From 3de31efa29b8f2729f968d9d63c42d21c7d8dcf5 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Fri, 22 Feb 2019 13:04:51 +0100 Subject: adds flow for deleting workspaces --- src/features/workspaces/store.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/features/workspaces/store.js') 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 { this.actions.workspace.edit.listen(this._edit); this.actions.workspace.create.listen(this._create); + this.actions.workspace.delete.listen(this._delete); } _setWorkspaces = (workspaces) => { @@ -77,4 +78,14 @@ export default class WorkspacesStore extends Store { throw error; } }; + + _delete = async ({ workspace }) => { + try { + await this.api.deleteWorkspace(workspace); + this.state.workspaces.remove(workspace); + this.stores.router.push('/settings/workspaces'); + } catch (error) { + throw error; + } + }; } -- cgit v1.2.3-54-g00ecf