aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/store.js
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-02-22 12:34:27 +0100
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-02-22 12:34:27 +0100
commit7e40b08e2f8ab2448dcbe2ce7b4e38ca66764b9c (patch)
tree6d02d9c1b096604ea70fbae4b04d7af0760ffc5f /src/features/workspaces/store.js
parentadd on enter key handler for form input component (diff)
downloadferdium-app-7e40b08e2f8ab2448dcbe2ce7b4e38ca66764b9c.tar.gz
ferdium-app-7e40b08e2f8ab2448dcbe2ce7b4e38ca66764b9c.tar.zst
ferdium-app-7e40b08e2f8ab2448dcbe2ce7b4e38ca66764b9c.zip
add form for creating workspaces
Diffstat (limited to 'src/features/workspaces/store.js')
-rw-r--r--src/features/workspaces/store.js14
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}