Skip to content
Snippets Groups Projects
Commit 1d346add authored by Loïc Poullain's avatar Loïc Poullain
Browse files

Do not start IR simulation on dotations page

parent 43797435
No related branches found
No related tags found
1 merge request!82Ajouter faux PLF
......@@ -48,11 +48,6 @@ export class SimulationPage extends PureComponent<Props, State> {
this.state = { indextab: 0 };
}
componentDidMount() {
const { initializeAppllicationStoreFromAPI } = this.props;
initializeAppllicationStoreFromAPI();
}
handleOnChangeIndex = (event, indextab) => {
this.setState({ indextab });
};
......
......@@ -2,10 +2,6 @@ import withWidth from "@material-ui/core/withWidth";
import { connect } from "react-redux";
import { compose } from "redux";
import {
fetchMetadataCasTypes,
simulateCasTypes,
} from "../../../redux/actions";
import { SimulationPage } from "./SimulationPage";
const mapStateToProps = (state, { width }) => {
......@@ -13,22 +9,7 @@ const mapStateToProps = (state, { width }) => {
return { useMobileView };
};
const mapDispatchToProps = dispatch => ({
initializeAppllicationStoreFromAPI: () => {
// rempli le store de l'application avec les données
// provenant de l'API
dispatch(fetchMetadataCasTypes()).then(() => {
// lance le calcul des cas types la premiere fois
// que le reformeur s'affiche
dispatch(simulateCasTypes());
});
},
});
export default compose(
withWidth(),
connect(
mapStateToProps,
mapDispatchToProps,
),
connect(mapStateToProps),
)(SimulationPage);
......@@ -13,7 +13,8 @@ import { Articles, CartesImpact as ImpactCards } from "../components/ir";
import PopinManager from "../components/PopinManager";
import withRoot from "../lib/withRoot";
import {
disabledEtat, fetchSimPop, showAddCasTypesPopin, simulateCasTypes,
disabledEtat, fetchMetadataCasTypes,
fetchSimPop, showAddCasTypesPopin, simulateCasTypes,
} from "../redux/actions";
// eslint-disable-next-line no-unused-vars
import { RootState } from "../redux/reducers";
......@@ -23,6 +24,7 @@ const mapStateToProps = ({ token }: RootState) => ({
});
const mapDispatchToProps = dispatch => ({
init: () => dispatch(fetchMetadataCasTypes()).then(() => dispatch(simulateCasTypes())),
showAddCasTypesPopin: () => dispatch(showAddCasTypesPopin()),
simulateCasTypes: () => {
dispatch(simulateCasTypes());
......@@ -51,7 +53,12 @@ type Props = PropsFromRedux & {
}
class IndexPage extends PureComponent<Props> {
class IRPage extends PureComponent<Props> {
componentDidMount() {
const { init } = this.props;
init();
}
render() {
const {
// eslint-disable-next-line no-shadow
......@@ -111,4 +118,4 @@ export default flow(
withRouter,
withRoot,
connector,
)(IndexPage);
)(IRPage);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment