homeflowjs 0.10.23 → 0.10.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ export const fetchUser = () => (dispatch) => {
23
23
  fetch('/user.ljson')
24
24
  .then((response) => response.json())
25
25
  .then((json) => {
26
- if (json) {
26
+ if (json?.user) {
27
27
  dispatch(setCurrentUser(json.user));
28
28
  dispatch(setLocalUser(json.user));
29
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.10.23",
3
+ "version": "0.10.24",
4
4
  "description": "JavaScript toolkit for Homeflow themes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -7,7 +7,7 @@ import { setCurrentUser } from '../../actions/user.actions';
7
7
  import notify from '../../app/notify';
8
8
 
9
9
  const ResetPasswordForm = ({
10
- user, setCurrentUser, inputClass, buttonClass, buttonSpanClass, pattern, patternTitle,
10
+ user, setCurrentUser, inputClass, buttonClass, buttonSpanClass, pattern, patternTitle, redirect,
11
11
  }) => {
12
12
  const [password, setPassword] = useState('');
13
13
  const [passwordConfirmation, setPasswordConfirmation] = useState('');
@@ -31,7 +31,7 @@ const ResetPasswordForm = ({
31
31
  .then(({ user }) => {
32
32
  setCurrentUser(user);
33
33
  notify('You have successfully changed your password.', 'success');
34
- history.push('/user');
34
+ history.push(redirect);
35
35
  })
36
36
  .catch((err) => console.error('Something went wrong.', err));
37
37
  };
@@ -77,6 +77,7 @@ ResetPasswordForm.propTypes = {
77
77
  buttonSpanClass: PropTypes.string,
78
78
  pattern: PropTypes.string,
79
79
  patternTitle: PropTypes.string,
80
+ redirect: PropTypes.string,
80
81
  };
81
82
 
82
83
  ResetPasswordForm.defaultProps = {
@@ -85,6 +86,7 @@ ResetPasswordForm.defaultProps = {
85
86
  buttonSpanClass: '',
86
87
  pattern: null,
87
88
  patternTitle: null,
89
+ redirect: '/user',
88
90
  };
89
91
 
90
92
  const mapStateToProps = (state) => ({