stats.js 631 B

123456789101112131415161718192021222324252627
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import BodyWrapper from '../components/BodyWrapper';
  4. import Stats from '../components/Stats';
  5. import { authUser } from '../actions';
  6. const StatsPage = ({ id }) => (
  7. <BodyWrapper>
  8. <Stats id={id} />
  9. </BodyWrapper>
  10. );
  11. StatsPage.getInitialProps = ({ req, reduxStore, query }) => {
  12. const token = req && req.cookies && req.cookies.token;
  13. if (token && reduxStore) reduxStore.dispatch(authUser(token));
  14. return { id: query && query.id };
  15. };
  16. StatsPage.propTypes = {
  17. id: PropTypes.string,
  18. };
  19. StatsPage.defaultProps = {
  20. id: '',
  21. };
  22. export default StatsPage;