BotZ/bot.z_web/src/App.js

31 lines
697 B
JavaScript

import React from 'react';
import IndexPage from './IndexPage.js';
const targetUrl = "http://localhost:3003"
class App extends React.Component {
constructor(props) {
super(props)
this.state = {targetUrl: targetUrl, loggedIn: false}
}
componentDidMount() {
fetch(this.targetUrl, {credentials: 'include'})
.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>
);
}
}
export default App;