logout.js 627 B

1234567891011121314151617181920212223
  1. import React, { Component } from 'react';
  2. import PropTypes from 'prop-types';
  3. import { bindActionCreators } from 'redux';
  4. import withRedux from 'next-redux-wrapper';
  5. import initialState from '../store';
  6. import { logoutUser } from '../actions';
  7. class LogoutPage extends Component {
  8. componentDidMount() {
  9. this.props.logoutUser();
  10. }
  11. render() {
  12. return <div />;
  13. }
  14. }
  15. LogoutPage.propTypes = {
  16. logoutUser: PropTypes.func.isRequired,
  17. };
  18. const mapDispatchToProps = dispatch => ({ logoutUser: bindActionCreators(logoutUser, dispatch) });
  19. export default withRedux(initialState, null, mapDispatchToProps)(LogoutPage);