diff --git a/frontend/src/App.js b/frontend/src/App.js index a60257f..237a6f9 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -49,6 +49,44 @@ class ProtectedRoute extends Component { ) } } + +class CheckRoute extends Component { + constructor(props) { + super(props); + this.state = { auth: null }; + } + + async componentWillMount() { + const url = "/simcompanies/API/testlogin"; + const response = await fetch(url); + if (response.status == "200") { + this.setState({ + auth: true + }); + } else { + this.setState({ + auth: false + }); + } + } + + render() { + const { component: Component, ...props } = this.props; + return ( + this.state.auth === null ? + "Loading..." : + ( + this.state.auth ? + : + + )} + /> + ) + } +} + class App extends Component { render() { @@ -71,8 +109,8 @@ class App extends Component { - - + +