logout page
This commit is contained in:
parent
ba12601dcd
commit
094be65a16
@ -68,7 +68,7 @@ class Header extends React.Component
|
|||||||
|
|
||||||
_handle_onLogout = () =>
|
_handle_onLogout = () =>
|
||||||
{
|
{
|
||||||
logout({ dispatch: this.props.dispatch });
|
this.props.router.push("/logout");
|
||||||
};
|
};
|
||||||
|
|
||||||
_handle_onToggleNotifications = () =>
|
_handle_onToggleNotifications = () =>
|
||||||
|
|||||||
@ -232,7 +232,7 @@ class InnerMenu extends React.Component
|
|||||||
{
|
{
|
||||||
const { number, status } = this.props;
|
const { number, status } = this.props;
|
||||||
const { loading, menuOpened, contracts_info, contract_events, contract_fines } = this.state;
|
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();
|
const count_fines = this._getFinesCount();
|
||||||
|
|
||||||
if(!loading)
|
if(!loading)
|
||||||
@ -252,7 +252,7 @@ class InnerMenu extends React.Component
|
|||||||
<a className={ this.props.router && this.props.router.asPath.indexOf("payments") > -1 ? "active" : "" }>График платежей</a>
|
<a className={ this.props.router && this.props.router.asPath.indexOf("payments") > -1 ? "active" : "" }>График платежей</a>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
{ 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 && (
|
||||||
<li>
|
<li>
|
||||||
<Link href={`/contract/${ number }/change`} shallow>
|
<Link href={`/contract/${ number }/change`} shallow>
|
||||||
<a className={ this.props.router && this.props.router.asPath.indexOf("change") > -1 ? "active" : "" }>Изменить график</a>
|
<a className={ this.props.router && this.props.router.asPath.indexOf("change") > -1 ? "active" : "" }>Изменить график</a>
|
||||||
@ -284,7 +284,7 @@ class InnerMenu extends React.Component
|
|||||||
<a className={ this.props.router && this.props.router.asPath.indexOf("events") > -1 ? "active" : "" }>События по договору { count_events > 0 && (<span>{ count_events }</span>) }</a>
|
<a className={ this.props.router && this.props.router.asPath.indexOf("events") > -1 ? "active" : "" }>События по договору { count_events > 0 && (<span>{ count_events }</span>) }</a>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
{ 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 && (
|
||||||
<li>
|
<li>
|
||||||
<Link href={`/contract/${ number }/fines`} shallow>
|
<Link href={`/contract/${ number }/fines`} shallow>
|
||||||
<a className={ this.props.router && this.props.router.asPath.indexOf("fines") > -1 ? "active" : "" }>Штрафы ГИБДД{ count_fines > 0 && (<span>{ count_fines }</span>) }</a>
|
<a className={ this.props.router && this.props.router.asPath.indexOf("fines") > -1 ? "active" : "" }>Штрафы ГИБДД{ count_fines > 0 && (<span>{ count_fines }</span>) }</a>
|
||||||
|
|||||||
86
pages/logout.js
Normal file
86
pages/logout.js
Normal file
@ -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 (
|
||||||
|
<React.Fragment>
|
||||||
|
<Head>
|
||||||
|
<title>ЛК Эволюция автолизинга</title>
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="ЛК Эволюция автолизинга"
|
||||||
|
/>
|
||||||
|
</Head>
|
||||||
|
<MainHeader logo_url={ process.env.NEXT_PUBLIC_MAIN_SITE } />
|
||||||
|
<main>
|
||||||
|
<section>
|
||||||
|
<div className="clear"></div>
|
||||||
|
<div className="container" style={{ width: "100vw", height: "80vh", display: "flex", alignItems: "center", justifyContent: "center", }}>
|
||||||
|
<SpinnerCircular size={90} thickness={51} speed={100} color="rgba(28, 1, 169, 1)" secondaryColor="rgba(236, 239, 244, 1)" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapStateToProps(state, ownProps)
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getServerSideProps = reduxWrapper.getServerSideProps(store =>
|
||||||
|
async ({ req, res, query }) =>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export default withRouter(connect(mapStateToProps)(LogoutPage));
|
||||||
Loading…
x
Reference in New Issue
Block a user