BotZ/bot.z_web/src/App.js

29 lines
672 B
JavaScript
Raw Normal View History

2019-08-02 00:10:59 +02:00
import React from 'react';
2019-08-06 10:09:10 +02:00
import IndexPage from './IndexPage.js';
class App extends React.Component {
constructor(props) {
super(props)
2019-08-07 17:53:28 +02:00
this.state = {targetUrl: props.targetUrl, loggedIn: false}
2019-08-06 10:09:10 +02:00
}
componentDidMount() {
2019-08-07 17:53:28 +02:00
fetch(this.targetUrl + '/status', {credentials: 'include'})
2019-08-06 10:09:10 +02:00
.then(response => response.json())
.then(data => this.setState({loggedIn: data.logged_in}));
}
render() {
return (
<div id="main" className="container">
<IndexPage targetUrl={this.state.targetUrl} loggedIn={this.state.loggedIn} />
</div>
);
}
2019-08-02 00:10:59 +02:00
}
export default App;