diff options
Diffstat (limited to 'src/stores/UserStore.js')
-rw-r--r-- | src/stores/UserStore.js | 15 |
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'; | |||
8 | import CachedRequest from './lib/CachedRequest'; | 8 | import CachedRequest from './lib/CachedRequest'; |
9 | import { gaEvent } from '../lib/analytics'; | 9 | import { gaEvent } from '../lib/analytics'; |
10 | 10 | ||
11 | import { matchPath } from 'react-router' | ||
12 | |||
11 | // TODO: split stores into UserStore and AuthStore | 13 | // TODO: split stores into UserStore and AuthStore |
12 | export default class UserStore extends Store { | 14 | export 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 | } |