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 Config from "./Config"; class App extends Component { constructor(props) { super(props); this.state = { servicesWindowOpen: false, filterWindowOpen: 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.configWindowOpen) { modal = this.setState({configWindowOpen: false})} onDone={() => this.setState({configDone: true})}/>; } return (
this.setState({servicesWindowOpen: true})} onOpenFilters={() => this.setState({filterWindowOpen: true})} onOpenConfig={() => this.setState({configWindowOpen: true})} onOpenUpload={() => this.setState({uploadWindowOpen: true})} onConfigDone={this.state.configDone} /> {modal}
); } } export default App;