import Settings from '../components/Settings' ; import * as actions from '../actions/' ; import { StoreState } from '../types' ; import { connect , Dispatch } from 'react-redux' ; import * as types from '../common-interfaces' ; import { save } from '../side-effect-functions' ; interface Props { initialValues : types . Settings ; } export function mapStateToProps ( { settings } ) { return { initialValues : { region : settings . settings . region , awsAccessKeyId : settings . settings . awsAccessKeyId , awsSecretAccessKey : settings . settings . awsSecretAccessKey , lineBreak : settings . settings . lineBreak , filters : settings . settings . filters , } , } ; } export function mapDispatchToProps ( dispatch ) { return { onSubmit : ( values ) => { dispatch ( actions . saveSettings ( { region : values . region , awsAccessKeyId : values . awsAccessKeyId , awsSecretAccessKey : values . awsSecretAccessKey , lineBreak : values . lineBreak , filters : values . filters , } , new Date ( ) , save ) ) ; dispatch ( actions . showMessage ( 'Saved !' ) ) ; } , } ; } export default connect ( mapStateToProps , mapDispatchToProps ) ( Settings ) ;