diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-26 15:26:20 +0100 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-26 15:26:20 +0100 |
commit | a2e4316879908c5bc2c38cef81eef9152476b6f6 (patch) | |
tree | 0542dc53ea28dd26a7b6b1731c856eb2887582d8 /src/features/workspaces/store.js | |
parent | handle get workspaces request errors in the ui (diff) | |
download | ferdium-app-a2e4316879908c5bc2c38cef81eef9152476b6f6.tar.gz ferdium-app-a2e4316879908c5bc2c38cef81eef9152476b6f6.tar.zst ferdium-app-a2e4316879908c5bc2c38cef81eef9152476b6f6.zip |
show infobox when updating workspaces
Diffstat (limited to 'src/features/workspaces/store.js')
-rw-r--r-- | src/features/workspaces/store.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index 3cec5f360..f7df7b29c 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -102,9 +102,7 @@ export default class WorkspacesStore { | |||
102 | @action _create = async ({ name }) => { | 102 | @action _create = async ({ name }) => { |
103 | try { | 103 | try { |
104 | const workspace = await createWorkspaceRequest.execute(name); | 104 | const workspace = await createWorkspaceRequest.execute(name); |
105 | await getUserWorkspacesRequest.patch((result) => { | 105 | await getUserWorkspacesRequest.result.push(workspace); |
106 | result.push(workspace); | ||
107 | }); | ||
108 | this._edit({ workspace }); | 106 | this._edit({ workspace }); |
109 | } catch (error) { | 107 | } catch (error) { |
110 | throw error; | 108 | throw error; |
@@ -114,9 +112,7 @@ export default class WorkspacesStore { | |||
114 | @action _delete = async ({ workspace }) => { | 112 | @action _delete = async ({ workspace }) => { |
115 | try { | 113 | try { |
116 | await deleteWorkspaceRequest.execute(workspace); | 114 | await deleteWorkspaceRequest.execute(workspace); |
117 | await getUserWorkspacesRequest.patch((result) => { | 115 | await getUserWorkspacesRequest.result.remove(workspace); |
118 | result.remove(workspace); | ||
119 | }); | ||
120 | this.stores.router.push('/settings/workspaces'); | 116 | this.stores.router.push('/settings/workspaces'); |
121 | } catch (error) { | 117 | } catch (error) { |
122 | throw error; | 118 | throw error; |
@@ -126,10 +122,9 @@ export default class WorkspacesStore { | |||
126 | @action _update = async ({ workspace }) => { | 122 | @action _update = async ({ workspace }) => { |
127 | try { | 123 | try { |
128 | await updateWorkspaceRequest.execute(workspace); | 124 | await updateWorkspaceRequest.execute(workspace); |
129 | await getUserWorkspacesRequest.patch((result) => { | 125 | // Path local result optimistically |
130 | const localWorkspace = result.find(ws => ws.id === workspace.id); | 126 | const localWorkspace = this._getWorkspaceById(workspace.id); |
131 | Object.assign(localWorkspace, workspace); | 127 | Object.assign(localWorkspace, workspace); |
132 | }); | ||
133 | this.stores.router.push('/settings/workspaces'); | 128 | this.stores.router.push('/settings/workspaces'); |
134 | } catch (error) { | 129 | } catch (error) { |
135 | throw error; | 130 | throw error; |