diff options
author | 2018-01-22 14:26:31 +0100 | |
---|---|---|
committer | 2018-01-22 14:26:31 +0100 | |
commit | 945cb5982c4b1b42d17ce91171b6a6740eb3a3e5 (patch) | |
tree | 8481794625abecea3230e49f789b7336be512bf0 /src/components | |
parent | ADDED invite button in Account Settings (diff) | |
download | ferdium-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
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/auth/Invite.js | 8 | ||||
-rw-r--r-- | src/components/settings/account/AccountDashboard.js | 4 | ||||
-rw-r--r-- | src/components/ui/Link.js | 5 |
3 files changed, 13 insertions, 4 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, |