import {combineReducers} from 'redux'
import {routerReducer as router} from 'react-router-redux'
import {reducer as form} from 'redux-form'
import authReducer, {moduleName as authModule} from '../ducks/main'
import peopleReducer, {moduleName as peopleModule} from '../ducks/people'
import connectionReducer, {moduleName as connectionModule} from '../ducks/connection'
import registrationReducer, {moduleName as registrationModule} from '../ducks/registration'
import checkReducer, {moduleName as checkModule} from '../ducks/check'
import productsReducer, {moduleName as productsModule} from '../ducks/products'
import { persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
const persistConfig = {
key: 'check',
storage: storage,
whitelist: ['check']
}
export default combineReducers({
router, form,
[authModule]: authReducer,
[peopleModule]: peopleReducer,
[connectionModule]: connectionReducer,
[registrationModule]: registrationReducer,
[checkModule] : persistReducer(persistConfig, checkReducer),
[productsModule]: productsReducer,
})
<Switch
circleStyles={{onColor:'#4caf50',offColor:'white'}}
switchStyles={{width:100,background:'#ccc' }}
labels={{on:'ВКЛ',off:'ВЫКЛ'}}
onChange={this.props.handleChangeSwitch('isWiFi')}
value={this.state.isWiFi}
/>
<Switch
circleStyles={{onColor: '#4caf50', offColor: 'white'}}
switchStyles={{width: 100, background: '#ccc'}}
labels={{on: 'ВКЛ', off: 'ВЫКЛ'}}
onChange={this.props.handleChangeSwitch('isBT')}
value={this.state.isBT}
/>
handleChangeSwitch = (param) => (value) => {
if(param === 'isBT' && value){
this.setState({isBT : true, isWiFi : false})
}
if(param === 'isBT' && !value){
this.setState({isBT : false})
}
if(param === 'isWiFi' && value){
this.setState({isWiFi : true, isBT : false})
}
if(param === 'isWiFi' && !value){
this.setState({isWiFi : false})
}
};
подменить прошлую страницу на другую?