import React from "react"; import {connect} from "react-redux"; import Operation from "../components/Operation"; import { SHOW_PRINT_PREVIEW, CLOSE_PRINT_PREVIEW, SHOW_PREVIEW, CLOSE_PREVIEW, DIAG_SHOW } from "../store/types/print"; import {saveMessage,clearMessages} from "../store/async-actions/print"; import {saveTemplateDetail} from '@store/async-actions/tabTemplate'; import {saveClickNum} from '@store/async-actions/homePage'; // function mapStateToProps({print}) { function mapStateToProps(state) { const {print,homePage} = state; return ({ print, winWidth:homePage.windowWidth }); } function mapDispatchToProps(dispatch) { return { showPrintPreview: () => { dispatch({ type: SHOW_PRINT_PREVIEW }); }, closePrintPreview: () => { dispatch({ type: CLOSE_PRINT_PREVIEW }); }, showPreview: () => { dispatch({ type: SHOW_PREVIEW }); }, closePreview: () => { dispatch({ type: CLOSE_PREVIEW }); }, save: () => { dispatch(saveClickNum); dispatch(() => saveMessage()) }, clear: () => { clearMessages() }, saveDataAll(val){ dispatch(saveTemplateDetail(val)) }, diagShowTmp(bool){ dispatch({ type: DIAG_SHOW, data:bool }); } }; } const OperationComtainer = connect( mapStateToProps, mapDispatchToProps )(Operation); export default OperationComtainer;