App.js 729 Bytes
import React from "react";
import './App.css';
import Login from "./Login";
import Body from "./Body";

const qs= require('querystring');
const url = require('url')

class App extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      isAuthenticated: false,
    }
  }
  
  componentDidMount(props){
    var urlQuery = url.parse(window.location.href).query;
    var param = qs.parse(urlQuery);
    this.setState({ isAuthenticated : param.authenticated}, () => {
      this.render();
    })
  }
  
  render(){
    return (
      <div className="app">
        {!this.state.isAuthenticated && <Login />}
        {this.state.isAuthenticated && <Body />}
      </div>
    );
  }
}

export default App;