diff --git a/pages/components/Header/index.js b/pages/components/Header/index.js index 9f4cbac..c27884b 100644 --- a/pages/components/Header/index.js +++ b/pages/components/Header/index.js @@ -68,7 +68,7 @@ class Header extends React.Component _handle_onLogout = () => { - logout({ dispatch: this.props.dispatch }); + this.props.router.push("/logout"); }; _handle_onToggleNotifications = () => diff --git a/pages/contract/components/InnerMenu/index.js b/pages/contract/components/InnerMenu/index.js index 69a5e97..8fba0fb 100644 --- a/pages/contract/components/InnerMenu/index.js +++ b/pages/contract/components/InnerMenu/index.js @@ -232,7 +232,7 @@ class InnerMenu extends React.Component { const { number, status } = this.props; const { loading, menuOpened, contracts_info, contract_events, contract_fines } = this.state; - const count_events = contract_events[number] !== undefined && contract_events[number] !== null ? Object.keys(contract_events[number]).length : 0; + const count_events = contract_events !== undefined && contract_events[number] !== undefined && contract_events[number] !== null ? Object.keys(contract_events[number]).length : 0; const count_fines = this._getFinesCount(); if(!loading) @@ -252,7 +252,7 @@ class InnerMenu extends React.Component -1 ? "active" : "" }>График платежей - { contracts_info[ number ].status !== undefined && contracts_info[ number ].status !== null && [46, 36, 37, 35].indexOf(contracts_info[ number ].status) > -1 && ( + { contracts_info !== undefined && contracts_info[ number ] !== undefined && contracts_info[ number ].status !== undefined && contracts_info[ number ].status !== null && [46, 36, 37, 35].indexOf(contracts_info[ number ].status) > -1 && (
  • -1 ? "active" : "" }>Изменить график @@ -284,7 +284,7 @@ class InnerMenu extends React.Component -1 ? "active" : "" }>События по договору { count_events > 0 && ({ count_events }) }
  • - { contract_fines[number] !== undefined && contract_fines[number] !== null && count_fines > 0 && ( + { contract_fines !== undefined && contract_fines[number] !== undefined && contract_fines[number] !== null && count_fines > 0 && (
  • -1 ? "active" : "" }>Штрафы ГИБДД{ count_fines > 0 && ({ count_fines }) } diff --git a/pages/logout.js b/pages/logout.js new file mode 100644 index 0000000..dad1452 --- /dev/null +++ b/pages/logout.js @@ -0,0 +1,86 @@ +import React from "react"; +import Head from 'next/head'; +import Image from 'next/image'; +import { connect } from "react-redux"; +import { withRouter } from 'next/router'; +import { reduxWrapper } from '../store'; +import pluralize from 'pluralize-ru'; +import { SpinnerCircular } from 'spinners-react'; + +import Header from './components/Header'; +import Footer from './components/Footer'; +import MainHeader from "./components/MainHeader"; +import FormRequest from "./components/FormRequest"; + +import { logout } from '../actions'; + +class LogoutPage extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + }; + } + + static getDerivedStateFromProps(nextProps, prevState) + { + return { + }; + } + + componentDidMount() + { + logout({ dispatch: this.props.dispatch, }) + .then(() => + { + this.props.router.push("/"); + }) + .catch(() => + { + this.props.router.push("/"); + }); + } + + render() + { + return ( + + + ЛК Эволюция автолизинга + + + +
    +
    +
    +
    + +
    +
    +
    +
    + ); + } +} + +function mapStateToProps(state, ownProps) +{ + return { + } +} + +export const getServerSideProps = reduxWrapper.getServerSideProps(store => + async ({ req, res, query }) => + { + return { + props: { + } + } + } +); + +export default withRouter(connect(mapStateToProps)(LogoutPage));