Skip to content

Commit 3448d9b

Browse files
committed
Fix EmailVerificationView for react-router v4. location prop no longer contains parsed query.
1 parent 51e4341 commit 3448d9b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

client/modules/User/pages/EmailVerificationView.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react';
33
import { connect } from 'react-redux';
44
import { bindActionCreators } from 'redux';
55
import { withTranslation } from 'react-i18next';
6-
import get from 'lodash/get';
76
import { Helmet } from 'react-helmet';
87
import browserHistory from '../../../browserHistory';
98
import { verifyEmailConfirmation } from '../actions';
@@ -22,7 +21,11 @@ class EmailVerificationView extends React.Component {
2221
}
2322
}
2423

25-
verificationToken = () => get(this.props, 'location.query.t', null);
24+
verificationToken = () => {
25+
const { location } = this.props;
26+
const searchParams = new URLSearchParams(location.search);
27+
return searchParams.get('t');
28+
};
2629

2730
render() {
2831
let status = null;
@@ -80,7 +83,10 @@ EmailVerificationView.propTypes = {
8083
'invalid'
8184
]),
8285
verifyEmailConfirmation: PropTypes.func.isRequired,
83-
t: PropTypes.func.isRequired
86+
t: PropTypes.func.isRequired,
87+
location: PropTypes.shape({
88+
search: PropTypes.string.isRequired
89+
}).isRequired
8490
};
8591

8692
export default withTranslation()(

0 commit comments

Comments
 (0)