diff options
Diffstat (limited to 'src/features/workspaces/store.js')
-rw-r--r-- | src/features/workspaces/store.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index ea61cec31..d90f9caac 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -49,6 +49,7 @@ export default class WorkspacesStore extends Store { | |||
49 | ); | 49 | ); |
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 | } | 53 | } |
53 | 54 | ||
54 | _setWorkspaces = (workspaces) => { | 55 | _setWorkspaces = (workspaces) => { |
@@ -64,5 +65,16 @@ export default class WorkspacesStore extends Store { | |||
64 | 65 | ||
65 | _edit = ({ workspace }) => { | 66 | _edit = ({ workspace }) => { |
66 | this.stores.router.push(`/settings/workspaces/edit/${workspace.id}`); | 67 | this.stores.router.push(`/settings/workspaces/edit/${workspace.id}`); |
67 | } | 68 | }; |
69 | |||
70 | _create = async ({ name }) => { | ||
71 | try { | ||
72 | const result = await this.api.createWorkspace(name); | ||
73 | const workspace = new Workspace(result); | ||
74 | this.state.workspaces.push(workspace); | ||
75 | this._edit({ workspace }); | ||
76 | } catch (error) { | ||
77 | throw error; | ||
78 | } | ||
79 | }; | ||
68 | } | 80 | } |