diff --git a/actions/authActions.js b/actions/authActions.js index 30d774b..109dd32 100644 --- a/actions/authActions.js +++ b/actions/authActions.js @@ -223,9 +223,11 @@ export const sendSwitchAccount = ({ dispatch, acc_number }) => dispatch({ type: actionTypes.USER, data: {} }); dispatch({ type: actionTypes.COMPANY, data: {} }); - dispatch({ type: actionTypes.CONTRACTS_INFO_RESET, data: {} }); dispatch({ type: actionTypes.EVENTS_RESET, data: {} }); dispatch({ type: actionTypes.SUPPORT_RESET, data: {} }); + dispatch({ type: actionTypes.CONTRACTS_INFO_RESET, data: {} }); + dispatch({ type: actionTypes.CONTRACT_EVENTS_RESET, data: {} }); + dispatch({ type: actionTypes.CONTRACT_FINES_RESET, data: {} }); return new Promise((resolve, reject) => { diff --git a/actions/contractActions.js b/actions/contractActions.js index 1ca38b8..fe5016c 100644 --- a/actions/contractActions.js +++ b/actions/contractActions.js @@ -320,35 +320,34 @@ export const getContractDocuments = ({ dispatch, number, }) => }); } -export const getContractFines = ({ dispatch, number, }) => +export const getContractFines = ({ dispatch, contract, }) => { - console.log("ACTION", "getContractFines"); + console.log("ACTION", "getContractFines", contract); return new Promise((resolve, reject) => { axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/fines`, { - number: number + number: contract }, { withCredentials: true, }) .then(async (response) => { - console.log("ACTION", "getContractFines", "response.data", response.data); - let fines = []; - let query = nSQL(response.data.fines).query("select"); query = query.orderBy({ date: "desc" }); query.exec().then((rows) => { - fines = rows; + console.log(global.store.getState().contract_fines); + const contract_fines = global.store.getState().contract_fines; - console.log("fines"); - console.log(fines); - dispatch({ type: actionTypes.CONTRACT_FINES, data: { fines: fines } }); - resolve(); + console.log("ACTION", "getContractFines", "contract_fines", contract_fines); + contract_fines[`${ contract }`] = rows; + + dispatch({ type: actionTypes.CONTRACT_FINES, data: contract_fines }); + resolve(); }); }) .catch((error) => @@ -371,7 +370,6 @@ export const getContractRules = ({ dispatch, date, }) => }) .then(async (response) => { - console.log("getContractRules", "response.data", response.data); dispatch({ type: actionTypes.CONTRACT_RULES, data: { rules: response.data.rules } }); resolve(); @@ -395,7 +393,6 @@ export const getContractMaterials = ({ dispatch, }) => }) .then(async (response) => { - console.log("getContractMaterials", "response.data", response.data); dispatch({ type: actionTypes.CONTRACT_MATERIALS, data: { materials: response.data.materials } }); resolve(); @@ -422,7 +419,6 @@ export const getContractPenalties = ({ number, date }) => }) .then(async (response) => { - console.log("getContractPenalties", "response.data", response.data); resolve(response.data); }) .catch((error) => @@ -469,8 +465,6 @@ export const getContractGraphicChangeSignatories = ({ dispatch, number }) => }) .then(async (response) => { - console.log("ACTION", "getContractGraphicChangeSignatories", "response.data", response.data); - dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { signatories: response.data.signatories } }); resolve(); }) @@ -490,16 +484,12 @@ export const getContractGraphicChangeVariants = ({ dispatch, number, variants = return new Promise((resolve, reject) => { - console.log("{ ...{ number }, ...variants }", { ...{ number }, ...{ variants: variants } }); - axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/variants`, { ...{ number }, ...{ variants: variants } }, { withCredentials: true, }) .then(async (response) => { - console.log("ACTION", "getContractGraphicChangeVariants", "response.data", response.data); - dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { variants: response.data } }); resolve(); }) @@ -525,8 +515,6 @@ export const getContractGraphicChangeCalculationsList = ({ dispatch, number }) = }) .then(async (response) => { - console.log("ACTION", "getContractGraphicChangeCalculationsList", "response.data", response.data); - dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { calculations: response.data.pre_calculations } }); resolve(); }) diff --git a/actions/eventsActions.js b/actions/eventsActions.js index 28aa1c6..a6871de 100644 --- a/actions/eventsActions.js +++ b/actions/eventsActions.js @@ -59,7 +59,7 @@ export const getEvents = ({ dispatch, type, contract }) => }); } -export const getFilteredEvents = ({ dispatch, search }) => +export const getFilteredEvents = ({ dispatch, search, contract }) => { return new Promise((resolve, reject) => { @@ -110,6 +110,11 @@ export const getFilteredEvents = ({ dispatch, search }) => query.where([ [ "contract_number", "LIKE", `%${ search }%` ], "OR", [ "add_info", "LIKE", `%${ search }%` ]]); } + if(contract !== undefined && contract !== null && contract !== "") + { + query.where([ [ "contract_number", "=", contract ] ]); + } + query.exec().then((rows) => { console.log("rows"); @@ -130,13 +135,13 @@ export const getFilteredEvents = ({ dispatch, search }) => export const getContractEvents = ({ dispatch, contract }) => { + console.log("ACTION", "getContractEvents"); + return new Promise((resolve, reject) => { - console.log("getContractEvents"); - - console.log(global.store.getState().events); const events = global.store.getState().events.list; - + console.log("ACTION", "getContractEvents", "events", events); + let query = nSQL(events) .query("select"); @@ -152,7 +157,7 @@ export const getContractEvents = ({ dispatch, contract }) => const events_list = {}; events_list[`${ contract }`] = rows; - + dispatch({ type: actionTypes.CONTRACT_EVENTS, data: events_list }); resolve(); }); diff --git a/constants/actionTypes.js b/constants/actionTypes.js index b88fc01..710919d 100644 --- a/constants/actionTypes.js +++ b/constants/actionTypes.js @@ -15,7 +15,6 @@ export const CONTRACT_REGISTRATION = 'CONTRACT_REGISTRATION'; export const CONTRACT_TELEMATIC = 'CONTRACT_TELEMATIC'; export const CONTRACT_AGREEMENT = 'CONTRACT_AGREEMENT'; export const CONTRACT_DOCUMENTS = 'CONTRACT_DOCUMENTS'; -export const CONTRACT_FINES = 'CONTRACT_FINES'; export const CONTRACT_RULES = 'CONTRACT_RULES'; export const CONTRACT_MATERIALS = 'CONTRACT_MATERIALS'; @@ -29,6 +28,9 @@ export const CONTRACT_CALCULATED = 'CONTRACT_CALCULATED'; export const CONTRACT_EVENTS = 'CONTRACT_EVENTS'; export const CONTRACT_EVENTS_RESET = 'CONTRACT_EVENTS_RESET'; +export const CONTRACT_FINES = 'CONTRACT_FINES'; +export const CONTRACT_FINES_RESET = 'CONTRACT_FINES_RESET'; + export const CALENDAR = 'CALENDAR'; export const EVENTS = 'EVENTS'; export const EVENTS_FILTERED = 'EVENTS_FILTERED'; diff --git a/pages/components/Manager/index.js b/pages/components/Manager/index.js index ec57c1b..3b940da 100644 --- a/pages/components/Manager/index.js +++ b/pages/components/Manager/index.js @@ -28,6 +28,21 @@ class Manager extends React.Component { const { company } = this.state; + this._loadManagerAvatar(); + } + + componentDidUpdate(prevProps, prevState) + { + if(prevState.company.manager_photo === undefined && this.state.company.manager_photo !== undefined) + { + this._loadManagerAvatar(); + } + } + + _loadManagerAvatar = () => + { + const { company } = this.state; + if(company.manager_photo !== undefined && company.manager_photo !== null && company.manager_photo !== "") { getImage({ id: company.manager_photo }) @@ -38,7 +53,10 @@ class Manager extends React.Component } else { - this.setState({ photo: null, loading: false }); + if(company.manager_photo !== undefined) + { + this.setState({ photo: null, loading: false }); + } } } diff --git a/pages/contract/change/components/Options/index.js b/pages/contract/change/components/Options/index.js index 9aae133..1d6cf23 100644 --- a/pages/contract/change/components/Options/index.js +++ b/pages/contract/change/components/Options/index.js @@ -308,7 +308,8 @@ class SumSelector extends React.Component const { onOption } = this.props; const { min, max } = this.state; - const value = parseFloat(event.target.value.replace(/[^\d]/mg, '')); + const value = parseFloat(event.target.value.replace(',','.').replace(/[^\d,.]/mg, '')); + if(value >= min && value <= max && !isNaN(value)) { this.setState({ value: value }, () => @@ -404,7 +405,7 @@ class InsurancePriceSelector extends React.Component //} //else //{ - const value = parseFloat(event.target.value.replace(/[^\d]/mg, '')); + const value = parseFloat(event.target.value.replace(',','.').replace(/[^\d,.]/mg, '')); if(value >= min && value <= max && !isNaN(value)) { this.setState({ value: value }, () => diff --git a/pages/contract/components/InnerMenu/index.js b/pages/contract/components/InnerMenu/index.js index f7c9744..69a5e97 100644 --- a/pages/contract/components/InnerMenu/index.js +++ b/pages/contract/components/InnerMenu/index.js @@ -1,7 +1,7 @@ import React from "react"; import Link from "next/link"; import { connect } from "react-redux"; -import { getContractEvents, } from "../../../../actions"; +import { getContractEvents, getContractFines, getContractInfo, } from "../../../../actions"; class InnerMenu extends React.Component { @@ -11,56 +11,188 @@ class InnerMenu extends React.Component this.menuRef = React.createRef(); this.state = { - menuOpened: false, - count_events: 0, - count_fines: 0, + loaded: false, + loading: true, + menuOpened: false, + contracts_info: {}, contract_events: {}, + contract_fines: {}, }; } static getDerivedStateFromProps(nextProps, prevState) { return { + contracts_info: nextProps.contracts_info, contract_events: nextProps.contract_events, + contract_fines: nextProps.contract_fines, }; } componentDidMount() { - const { number, dispatch } = this.props; - const { contract_events } = this.state; + console.log("Contact", "InnerMenu", "componentDidMount()"); - if(contract_events[number] === undefined) - { - getContractEvents({ dispatch, contract: number }); - } + const { loaded, loading, contracts_info, contract_events, contract_fines } = this.state; - let l = 0; - let m = 0; - const menu = [ "payments", "services", "agreement", "documents", "materials", "events", "change" ]; + console.log("CDM", "\n\n"); + console.log("CDM", "contracts_info", contracts_info); + console.log("CDM", "!".repeat(10)); + console.log("CDM", "contract_events", contract_events); + console.log("CDM", "!".repeat(10)); + console.log("CDM", "contract_fines", contract_fines); + console.log("CDM", "!".repeat(10)); - for(let i in menu) - { - if(this.props.router.asPath.indexOf(menu[i]) > -1) + if(!loaded && + contracts_info !== undefined && Object.keys(contracts_info).length > 0 && + contract_events !== undefined && Object.keys(contract_events).length > 0 && + contract_fines !== undefined && Object.keys(contract_fines).length > 0 + ) { + this.setState({ loaded: true }, () => { - m = i; - } + this._loadMenu(); + }); } + } - for(let i = 0; i < m; i++) + componentDidUpdate(prevProps, prevState) + { + const { loaded, contracts_info, contract_events, contract_fines } = this.state; + + console.log("CDU", "\n\n"); + console.log("CDU", "contracts_info", contracts_info); + console.log("CDU", "?".repeat(10)); + console.log("CDU", "contract_events", contract_events); + console.log("CDU", "?".repeat(10)); + console.log("CDU", "contract_fines", contract_fines); + console.log("CDU", "?".repeat(10)); + + if(!loaded && + contracts_info !== undefined && Object.keys(contracts_info).length > 0 && + contract_events !== undefined && Object.keys(contract_events).length > 0 && + contract_fines !== undefined && Object.keys(contract_fines).length > 0 + ) { + this.setState({ loaded: true }, () => + { + this._loadMenu(); + }); + } + } + + _loadMenu = () => + { + console.log("Contract", "InnerMenu", "_loadMenu()"); + + const { number, dispatch } = this.props; + const { contracts_info, contract_events, contract_fines } = this.state; + + Promise.all([ + new Promise((resolve) => + { + console.log(11111); + if(contracts_info[ number ] === undefined) + { + console.log(10); + getContractInfo({ dispatch, number }) + .then(() => { console.log(11); resolve(); }) + .catch(() => { console.log(12); resolve(); }); + } + else + { + console.log(13); + resolve(); + } + }), + new Promise((resolve) => + { + console.log(22222); + if(contract_events[ number ] === undefined) + { + console.log(20); + getContractEvents({ dispatch, contract: number }) + .then(() => { console.log(21); resolve(); }) + .catch(() => { console.log(22); resolve(); }); + } + else + { + console.log(23); + resolve(); + } + }), + new Promise((resolve) => + { + console.log(33333); + if(contract_fines[ number ] === undefined) + { + console.log(30); + getContractFines({ dispatch, contract: number }) + .then(() => { console.log(31); resolve(); }) + .catch(() => { console.log(32); resolve(); }); + } + else + { + console.log(33); + resolve(); + } + }), + ]) + .then(() => { - l = l + this.menuRef.current.children[i].getBoundingClientRect().width; - } + console.log("******************************"); + let l = 0; + let m = 0; + const menu = [ "payments", "change", "services", "agreement", "documents", "materials", "events", "fines" ]; - this.menuRef.current.scrollLeft = l - 50; + for(let i in menu) + { + if(this.props.router.asPath.indexOf(menu[i]) > -1) + { + m = i; + } + } + + //setTimeout(() => + //{ + this.setState({ loading: false }, () => + { + if(this.menuRef.current !== null) + { + console.log("-".repeat(30)); + console.log(this.menuRef.current); + console.log("-".repeat(30)); + + for(let i = 0; i < m; i++) + { + //console.log("-----", this.menuRef.current.children[i]); + if(this.menuRef.current.children[i] !== undefined) + { + console.log("this.menuRef.current.children[i]", this.menuRef.current.children[i]); + console.log(".".repeat(30)); + + l = l + this.menuRef.current.children[i].getBoundingClientRect().width; + console.log("W", this.menuRef.current.children[i].getBoundingClientRect().width, l); + } + } + + //setTimeout(() => + //{ + if(this.menuRef.current !== null) + { + this.menuRef.current.scrollLeft = l - 50; + } + //}, 10); + } + }); + //}, 50); + }); } _handle_onToggleMenu = () => { this.setState({ - menuOpened: !this.state.menuOpened, + menuOpened: !this.state.menuOpened, }); - }; + } _getActiveLink = (route) => { @@ -74,65 +206,93 @@ class InnerMenu extends React.Component if (route.indexOf("/fines") > -1) return "Штрафы ГИБДД"; return null; - }; + } + + _getFinesCount = () => + { + const { number, } = this.props; + const { contract_fines } = this.state; + let c = 0; + + if(contract_fines[number] !== undefined && contract_fines[number] !== null) + { + for(let i in contract_fines[number]) + { + if(contract_fines[number][i].status_code === "NotPaid") + { + c++; + } + } + } + + return c; + } render() { const { number, status } = this.props; - const { menuOpened, count_fines, contract_events } = 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_fines = this._getFinesCount(); - console.log("contract_events", contract_events); + if(!loading) + { + console.log("contracts_info", contracts_info); + } return ( ) } @@ -141,7 +301,9 @@ class InnerMenu extends React.Component function mapStateToProps(state, ownProps) { return { - contract_events: state.contract_events + contracts_info: state.contracts_info, + contract_events: state.contract_events, + contract_fines: state.contract_fines, }; } diff --git a/pages/contract/fines.js b/pages/contract/fines.js index 263e62f..fbd90bc 100644 --- a/pages/contract/fines.js +++ b/pages/contract/fines.js @@ -43,6 +43,7 @@ class ContractFinesPage extends React.Component contracts_info: [], fines: null, all: false, + contract_fines: {}, }; } @@ -50,28 +51,52 @@ class ContractFinesPage extends React.Component { return { contracts_info: nextProps.contracts_info, - fines: nextProps.fines, + fines: nextProps.fines, + contract_fines: nextProps.contract_fines, }; } componentDidMount() { const { dispatch, number} = this.props; + const { contracts_info, contract_fines } = this.state; if(!this.state.loading && number !== undefined) { this.setState({ loading: true }, () => { - if(this.state.contracts_info[ number ] === undefined) - { - getContractInfo({ dispatch, number }); - } - - getContractFines({ dispatch, number }).then(() => + Promise.all([ + ( (resolve) => + { + if(contracts_info[ number ] === undefined) + { + getContractInfo({ dispatch, number }) + .then(() => { resolve(); }) + .catch(() => { resolve(); }); + } + else + { + resolve(); + } + } ), + ( (resolve) => + { + if(contract_fines[number] === undefined) + { + getContractFines({ dispatch, contract: number }) + .then(() => { resolve(); }) + .catch(() => { resolve(); }); + } + else + { + resolve(); + } + } ) + ]) + .then(() => { this.setState({ loading: false }); - }) - .catch(() => {}); + }); }); } } @@ -85,11 +110,11 @@ class ContractFinesPage extends React.Component this.setState({ all: true }); } - _renderFines = (fines) => + _renderFines = (contract_fines) => { - console.log("_renderFines", "fines", fines); - const { number } = this.props; + const fines = contract_fines[number]; + const { all } = this.state; const status = { @@ -102,103 +127,103 @@ class ContractFinesPage extends React.Component { return ( <> -
- { fines.slice(0, all ? fines.length : 3).map((fine, fine_index) => ( -
-
-
-

- № постановления: {fine.fine_number} -

-
    -
  • - Дата нарушения:{" "} - - {moment(fine.violation_date).format("DD.MM.YYYY")} - -
  • - -
  • - Сумма:{" "} - - {numeral(fine.amount).format(" ., ")} ₽ - -
  • - -
  • - Статус:{" "} - - {fine.status} - -
  • -
+
+ { fines.slice(0, all ? fines.length : 10).map((fine, fine_index) => ( +
+
+
+

+ № постановления: {fine.fine_number} +

+
    +
  • + Дата нарушения:{" "} + + {moment(fine.violation_date).format("DD.MM.YYYY")} + +
  • + +
  • + Сумма:{" "} + + {numeral(fine.amount).format(" ., ")} ₽ + +
  • + +
  • + Статус:{" "} + + {fine.status} + +
  • +
-
    - { fine.violation_place !== undefined && fine.violation_place !== null && ( -
  • - Место нарушения: {fine.violation_place} -
  • - ) } - {fine.gibdd !== undefined && fine.gibdd !== null && ( -
  • - Подразделение: {fine.gibdd} -
  • - )} -
-

- Штраф: {fine.fine_title} -

-
- { fine.status_code !== "PaidIndependently" && ( -
-
-

- Счет на оплату -

- -
-
- ) } +
    + { fine.violation_place !== undefined && fine.violation_place !== null && ( +
  • + Место нарушения: {fine.violation_place} +
  • + ) } + {fine.gibdd !== undefined && fine.gibdd !== null && ( +
  • + Подразделение: {fine.gibdd} +
  • + )} +
+

+ Штраф: {fine.fine_title} +

- {/*} - - {*/} + { fine.status_code !== "PaidIndependently" && ( +
+
+

+ Счет на оплату +

+ +
+
+ ) }
- )) } - { !all && fines.length > 3 && ( -
-

- Еще {fines.length - 3}{" "} - {pluralize( - fines.length - 3, - "постановлений", - "постановление", - "постановления", - "постановлений" - )} -

-
- ) } -
+ {/*} + + {*/} +
+ )) } + { !all && fines.length > 3 && ( +
+

+ Еще {fines.length - 10}{" "} + {pluralize( + fines.length - 10, + "постановлений", + "постановление", + "постановления", + "постановлений" + )} +

+
+ ) } +
); } @@ -218,13 +243,10 @@ class ContractFinesPage extends React.Component render() { const { number } = this.props; - const { loading, contracts_info, fines, } = this.state; + const { loading, contracts_info, contract_fines, } = this.state; let { date, car, status } = contracts_info[ number ] !== undefined ? contracts_info[ number ] : {}; - console.log("fines"); - console.log(fines); - return ( @@ -254,11 +276,11 @@ class ContractFinesPage extends React.Component

Штрафы ГИБДД

- {fines !== undefined && fines !== null ? ( + { contract_fines !== undefined && contract_fines !== null && contract_fines[ number ] !== undefined && contract_fines[ number ] !== null && ( <> - {this._renderFines(fines)} + { this._renderFines(contract_fines) } - ) : null} + ) }
@@ -287,6 +309,7 @@ function mapStateToProps(state, ownProps) date: state.contract.date, car: state.contract.car, fines: state.contract.fines, + contract_fines: state.contract_fines, }; } @@ -301,20 +324,4 @@ export const getServerSideProps = reduxWrapper.getServerSideProps( } ); -export default withRouter(connect(mapStateToProps)(ContractFinesPage)); - -{ -/*} -
-
-

№ постановления: 3432434242334

- -
-
-{*/ -} +export default withRouter(connect(mapStateToProps)(ContractFinesPage)); \ No newline at end of file diff --git a/pages/support/appeals.js b/pages/support/appeals.js index 25319d0..a53b80c 100644 --- a/pages/support/appeals.js +++ b/pages/support/appeals.js @@ -169,8 +169,12 @@ class SupportAppealsPage extends React.Component ) }
-

Ответ службы клиентского сервиса

-

") }}>

+ { ((appeal.answer !== null && appeal.answer !== "") || (appeal.documents.length > 0)) && ( +

Ответ службы клиентского сервиса

+ ) } + { appeal.answer !== null && appeal.answer !== "" && ( +

") }}>

+ ) } { appeal.documents.length > 0 && (
{ appeal.documents.map((file, index) => { diff --git a/reducers/contractFinesReducer.js b/reducers/contractFinesReducer.js new file mode 100644 index 0000000..b8753b3 --- /dev/null +++ b/reducers/contractFinesReducer.js @@ -0,0 +1,28 @@ +import { HYDRATE } from 'next-redux-wrapper'; + +import * as actionTypes from '../constants/actionTypes'; +import initialState from "./initialState"; + +const contractFinesReducer = (state = initialState.contract_fines, action) => +{ + switch (action.type) + { + case actionTypes.CONTRACT_FINES: + { + return { + ...state, ...action.data, + }; + } + + case actionTypes.CONTRACT_FINES_RESET: + { + return {}; + } + + default: { + return state; + } + } +}; + +export default contractFinesReducer; \ No newline at end of file diff --git a/reducers/contractReducer.js b/reducers/contractReducer.js index 7be5496..c13cb92 100644 --- a/reducers/contractReducer.js +++ b/reducers/contractReducer.js @@ -81,14 +81,6 @@ const contractReducer = (state = initialState.contract, action) => }; } - case actionTypes.CONTRACT_FINES: - { - return { - ...state, - fines: action.data.fines, - }; - } - case actionTypes.CONTRACT_RULES: { return { diff --git a/reducers/initialState.js b/reducers/initialState.js index fd16fbd..e69b6ba 100644 --- a/reducers/initialState.js +++ b/reducers/initialState.js @@ -11,10 +11,6 @@ export const defaultState = { secondname: "", phone: "", }, - companies: - { - list: null, - }, admin: { list: null, @@ -26,6 +22,10 @@ export const defaultState = { kpp: "", ogrn: "", }, + companies: + { + list: null, + }, contracts_info: {}, contracts: { @@ -65,6 +65,7 @@ export const defaultState = { }, }, contract_events: {}, + contract_fines: {}, calendar: { payments: null, periods: null, diff --git a/store/index.js b/store/index.js index a1ed84d..0ce681d 100644 --- a/store/index.js +++ b/store/index.js @@ -13,6 +13,7 @@ import supportReducer from '../reducers/supportReducer'; import adminReducer from '../reducers/adminReducer'; import contractsInfoReducer from '../reducers/contractsInfoReducer'; import contractEventsReducer from '../reducers/contractEventsReducer'; +import contractFinesReducer from '../reducers/contractFinesReducer'; const combinedReducer = combineReducers({ auth: authReducer, @@ -27,34 +28,35 @@ const combinedReducer = combineReducers({ admin: adminReducer, contracts_info: contractsInfoReducer, contract_events: contractEventsReducer, + contract_fines: contractFinesReducer, }); const makeStore = (context) => { const isServer = typeof window === 'undefined'; - if(isServer) + if(isServer) { return createStore(combinedReducer); - } + } else { const { persistStore, persistReducer } = require('redux-persist'); - const storage = require('redux-persist/lib/storage').default; + const storage = require('redux-persist/lib/storage').default; - const persistConfig = { - key: 'lkevoleasing', - whitelist: [ 'auth', 'user', 'company', 'companies', 'contracts_info', 'contract_events' ], - storage - }; + const persistConfig = { + key: 'lkevoleasing', + whitelist: [ 'auth', 'user', 'company', 'events', 'companies', 'contracts_info', 'contract_events', 'contract_fines', ], + storage + }; - const persistedReducer = persistReducer(persistConfig, combinedReducer); - const store = createStore(persistedReducer); + const persistedReducer = persistReducer(persistConfig, combinedReducer); + const store = createStore(persistedReducer); - store.__persistor = persistStore(store); + store.__persistor = persistStore(store); window.store = store; - return store; + return store; } }