aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/UserStore.js
diff options
context:
space:
mode:
authorLibravatar haraldox <hnaumann+github@gmail.com>2018-02-02 11:01:38 +0100
committerLibravatar haraldox <hnaumann+github@gmail.com>2018-02-02 11:01:38 +0100
commitf74d47acb7ee470e24245667c9195604faa66a20 (patch)
tree1f441a5acbf1e8661f47a8cf5ca8bc30493d5724 /src/stores/UserStore.js
parent[WIP] started work on infobox (diff)
downloadferdium-app-f74d47acb7ee470e24245667c9195604faa66a20.tar.gz
ferdium-app-f74d47acb7ee470e24245667c9195604faa66a20.tar.zst
ferdium-app-f74d47acb7ee470e24245667c9195604faa66a20.zip
got server callback and infobox working
Diffstat (limited to 'src/stores/UserStore.js')
-rw-r--r--src/stores/UserStore.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js
index 152090f46..82eab9f44 100644
--- a/src/stores/UserStore.js
+++ b/src/stores/UserStore.js
@@ -8,6 +8,8 @@ import Request from './lib/Request';
8import CachedRequest from './lib/CachedRequest'; 8import CachedRequest from './lib/CachedRequest';
9import { gaEvent } from '../lib/analytics'; 9import { gaEvent } from '../lib/analytics';
10 10
11import { matchPath } from 'react-router'
12
11// TODO: split stores into UserStore and AuthStore 13// TODO: split stores into UserStore and AuthStore
12export default class UserStore extends Store { 14export default class UserStore extends Store {
13 BASE_ROUTE = '/auth'; 15 BASE_ROUTE = '/auth';
@@ -161,15 +163,18 @@ export default class UserStore extends Store {
161 gaEvent('User', 'retrievePassword'); 163 gaEvent('User', 'retrievePassword');
162 } 164 }
163 165
164 @action _invite({ invites, from }) { 166 // TODO: REFACTOR from -> fromRoute
167 @action async _invite({ invites, from }) {
165 const data = invites.filter(invite => invite.email !== ''); 168 const data = invites.filter(invite => invite.email !== '');
166 169
167 this.inviteRequest.execute(data); 170 const response = await this.inviteRequest.execute(data)._promise;
168 171
169 console.log(from) 172 this.actionStatus = response.status || []
170 173
171 // we do not wait for a server response before redirecting the user 174 // we do not wait for a server response before redirecting the user ONLY DURING SIGNUP
172 this.stores.router.push(from + '?success=true' || '/'); 175 if (this.stores.router.location.pathname.includes(this.INVITE_ROUTE)) {
176 this.stores.router.push('/');
177 }
173 178
174 gaEvent('User', 'inviteUsers'); 179 gaEvent('User', 'inviteUsers');
175 } 180 }