import React, { Component } from "react"; import { BrowserRouter, Switch, Route, Redirect } from "react-router-dom"; import Home from "./views/Home"; import Dashboard from "./views/Dashboard"; import Signup from "./views/Signup"; import Login from "./views/Login"; import FourOhFour from "./views/FourOhFour"; import ForgotPass from "./views/Forgot-password"; import ChangePass from "./views/Forgot-pass-reset"; import ConfirmForgotPasswrod from "./views/ConfirmForgotPassword"; import ConfirmRegistration from "./views/ConfirmRegistration"; import ConfirmResetPassword from "./views/ConfirmResetPassword"; import Instruction from "./views/Instruction"; import queryString from "query-string"; import { RemoteService } from "./remote"; import { connect } from "react-redux"; class App extends Component { constructor(props, context) { super(props, context); this.state = { query: "", info: "", }; } componentDidMount() { if (window.location) { const values = queryString.parse(window.location.search); this.setState({ query: values, }); } } render() { console.log("rendering root", this.props.loggedIn, this.state.query); return ( {this.props.loggedIn ? : } {this.props.loggedIn ? : } ); } } const mapStateToProps = (state, _) => ({ loggedIn: state.login.loggedIn }); const AppContainer = connect(mapStateToProps, RemoteService)(App); export default AppContainer;