import React, {Component} from 'react'; import Header from "./Header"; import MainPane from "./MainPane"; import Footer from "./Footer"; import {BrowserRouter as Router} from "react-router-dom"; import Services from "./Services"; import Filters from "./Filters"; import Rules from "./Rules"; import Config from "./Config"; class App extends Component { constructor(props) { super(props); this.state = { servicesWindowOpen: false, filterWindowOpen: false, rulesWindowOpen: false, configWindowOpen: false, configDone: false }; fetch('/api/services') .then(response => { if( response.status === 503){ this.setState({configWindowOpen: true}); } else if (response.status === 200){ this.setState({configDone: true}); } }); } render() { let modal; if (this.state.servicesWindowOpen) { modal = this.setState({servicesWindowOpen: false})}/>; } if (this.state.filterWindowOpen) { modal = this.setState({filterWindowOpen: false})}/>; } if (this.state.rulesWindowOpen) { modal = this.setState({rulesWindowOpen: false})}/>; } if (this.state.configWindowOpen) { modal = this.setState({configWindowOpen: false})} onDone={() => this.setState({configDone: true})}/>; } return (
this.setState({servicesWindowOpen: true})} onOpenFilters={() => this.setState({filterWindowOpen: true})} onOpenRules={() => this.setState({rulesWindowOpen: true})} onOpenConfig={() => this.setState({configWindowOpen: true})} onOpenUpload={() => this.setState({uploadWindowOpen: true})} onConfigDone={this.state.configDone} /> {modal}
); } } export default App;