aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar haraldox <hnaumann+github@gmail.com>2018-01-22 14:26:31 +0100
committerLibravatar haraldox <hnaumann+github@gmail.com>2018-01-22 14:26:31 +0100
commit945cb5982c4b1b42d17ce91171b6a6740eb3a3e5 (patch)
tree8481794625abecea3230e49f789b7336be512bf0
parentADDED invite button in Account Settings (diff)
downloadferdium-app-945cb5982c4b1b42d17ce91171b6a6740eb3a3e5.tar.gz
ferdium-app-945cb5982c4b1b42d17ce91171b6a6740eb3a3e5.tar.zst
ferdium-app-945cb5982c4b1b42d17ce91171b6a6740eb3a3e5.zip
return to account screen from invite screen
cheap solution because `state` prop of `<Link>` is not being passed to route
-rw-r--r--src/components/auth/Invite.js8
-rw-r--r--src/components/settings/account/AccountDashboard.js4
-rw-r--r--src/components/ui/Link.js5
-rw-r--r--src/containers/auth/InviteScreen.js8
-rw-r--r--src/containers/settings/AccountScreen.js1
-rw-r--r--src/stores/UserStore.js6
6 files changed, 21 insertions, 11 deletions
diff --git a/src/components/auth/Invite.js b/src/components/auth/Invite.js
index c1d815dcd..d4d789781 100644
--- a/src/components/auth/Invite.js
+++ b/src/components/auth/Invite.js
@@ -64,7 +64,10 @@ export default class Invite extends Component {
64 e.preventDefault(); 64 e.preventDefault();
65 this.form.submit({ 65 this.form.submit({
66 onSuccess: (form) => { 66 onSuccess: (form) => {
67 this.props.onSubmit({ invites: form.values().invite }); 67 this.props.onSubmit({
68 invites: form.values().invite,
69 from: this.props.from
70 });
68 }, 71 },
69 onError: () => {}, 72 onError: () => {},
70 }); 73 });
@@ -73,6 +76,7 @@ export default class Invite extends Component {
73 render() { 76 render() {
74 const { form } = this; 77 const { form } = this;
75 const { intl } = this.context; 78 const { intl } = this.context;
79 const { from } = this.props;
76 80
77 return ( 81 return (
78 <div className="auth__container auth__container--signup"> 82 <div className="auth__container auth__container--signup">
@@ -99,7 +103,7 @@ export default class Invite extends Component {
99 label={intl.formatMessage(messages.submitButtonLabel)} 103 label={intl.formatMessage(messages.submitButtonLabel)}
100 /> 104 />
101 <Link 105 <Link
102 to="/" 106 to={ !!from ? from : '/'}
103 className="franz-form__button franz-form__button--secondary auth__button auth__button--skip" 107 className="franz-form__button franz-form__button--secondary auth__button auth__button--skip"
104 > 108 >
105 {intl.formatMessage(messages.skipButtonLabel)} 109 {intl.formatMessage(messages.skipButtonLabel)}
diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.js
index 1e71beadf..d5f2e238c 100644
--- a/src/components/settings/account/AccountDashboard.js
+++ b/src/components/settings/account/AccountDashboard.js
@@ -118,6 +118,7 @@ export default class AccountDashboard extends Component {
118 deleteAccount, 118 deleteAccount,
119 isLoadingDeleteAccount, 119 isLoadingDeleteAccount,
120 isDeleteAccountSuccessful, 120 isDeleteAccountSuccessful,
121 pathname,
121 } = this.props; 122 } = this.props;
122 const { intl } = this.context; 123 const { intl } = this.context;
123 124
@@ -189,7 +190,8 @@ export default class AccountDashboard extends Component {
189 <Link 190 <Link
190 to={{ 191 to={{
191 pathname: '/auth/signup/invite', 192 pathname: '/auth/signup/invite',
192 state: { fromSettings: true } 193 query: { from: pathname },
194 // state: { "from": 'hi' } // is not being passed to route
193 }} 195 }}
194 className="button account__invite-button"> 196 className="button account__invite-button">
195 {intl.formatMessage(messages.accountInviteButton)} 197 {intl.formatMessage(messages.accountInviteButton)}
diff --git a/src/components/ui/Link.js b/src/components/ui/Link.js
index f5da921fa..bc3c2d8aa 100644
--- a/src/components/ui/Link.js
+++ b/src/components/ui/Link.js
@@ -62,7 +62,10 @@ Link.wrappedComponent.propTypes = {
62 oneOrManyChildElements, 62 oneOrManyChildElements,
63 PropTypes.string, 63 PropTypes.string,
64 ]).isRequired, 64 ]).isRequired,
65 to: PropTypes.string.isRequired, 65 to: PropTypes.oneOfType([
66 PropTypes.string,
67 PropTypes.object
68 ]).isRequired,
66 className: PropTypes.string, 69 className: PropTypes.string,
67 activeClassName: PropTypes.string, 70 activeClassName: PropTypes.string,
68 strictFilter: PropTypes.bool, 71 strictFilter: PropTypes.bool,
diff --git a/src/containers/auth/InviteScreen.js b/src/containers/auth/InviteScreen.js
index 6b39b1dd1..a624e2245 100644
--- a/src/containers/auth/InviteScreen.js
+++ b/src/containers/auth/InviteScreen.js
@@ -11,13 +11,15 @@ export default class InviteScreen extends Component {
11 } 11 }
12 12
13 render() { 13 render() {
14 const { actions } = this.props; 14 const {
15 15 actions,
16 console.log(this.props.location.state) 16 location
17 } = this.props;
17 18
18 return ( 19 return (
19 <Invite 20 <Invite
20 onSubmit={actions.user.invite} 21 onSubmit={actions.user.invite}
22 from={location.query.from}
21 /> 23 />
22 ); 24 );
23 } 25 }
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js
index c5c2982b0..b57530884 100644
--- a/src/containers/settings/AccountScreen.js
+++ b/src/containers/settings/AccountScreen.js
@@ -83,6 +83,7 @@ export default class AccountScreen extends Component {
83 deleteAccount={userActions.delete} 83 deleteAccount={userActions.delete}
84 isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} 84 isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting}
85 isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} 85 isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError}
86 pathname={this.props.location.pathname}
86 /> 87 />
87 ); 88 );
88 } 89 }
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js
index 2c164f1bf..476c1f040 100644
--- a/src/stores/UserStore.js
+++ b/src/stores/UserStore.js
@@ -160,15 +160,13 @@ export default class UserStore extends Store {
160 gaEvent('User', 'retrievePassword'); 160 gaEvent('User', 'retrievePassword');
161 } 161 }
162 162
163 @action _invite({ invites }) { 163 @action _invite({ invites, from }) {
164 const data = invites.filter(invite => invite.email !== ''); 164 const data = invites.filter(invite => invite.email !== '');
165 165
166 this.inviteRequest.execute(data); 166 this.inviteRequest.execute(data);
167 167
168 console.log(this.stores.router.location )
169
170 // we do not wait for a server response before redirecting the user 168 // we do not wait for a server response before redirecting the user
171 this.stores.router.push('/'); 169 this.stores.router.push(!!from ? from : '/');
172 170
173 gaEvent('User', 'inviteUsers'); 171 gaEvent('User', 'inviteUsers');
174 } 172 }