fix(client): make render functions pure

This commit is contained in:
Valeriy S
2019-02-14 15:27:05 +03:00
committed by Stuart Taylor
parent 361ce5cd8e
commit 5e137d2022
2 changed files with 9 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { navigate } from 'gatsby';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
@@ -17,6 +16,8 @@ import {
activeDonationsSelector
} from '../redux';
import { randomQuote } from '../utils/get-words';
import createRedirect from '../components/createRedirect';
import RedirectHome from '../components/RedirectHome';
import './welcome.css';
@@ -52,6 +53,7 @@ const mapStateToProps = createSelector(
})
);
const mapDispatchToProps = dispatch => bindActionCreators({}, dispatch);
const RedirectAcceptPrivacyTerm = createRedirect('/accept-privacy-terms');
function Welcome({
fetchState: { pending, complete },
@@ -76,13 +78,11 @@ function Welcome({
}
if (!isSignedIn) {
navigate('/');
return null;
return <RedirectHome />;
}
if (isSignedIn && !acceptedPrivacyTerms) {
navigate('/accept-privacy-terms');
return null;
return <RedirectAcceptPrivacyTerm />;
}
const { quote, author } = randomQuote();