import React, { Component } from "react";
import "./App.css";
import {
BrowserRouter as Router,
Route,
Switch,
Redirect,
} from "react-router-dom";
import { connect } from "react-redux";
import { user } from "~/Redux/actions";
import proxy from "./Redux/proxy";
import Home from "./views/Home/index";
import Faq from "./views/Faq/index";
import Contact from "./views/Contact/index";
import About from "./views/About/index";
import Products from "./views/Products/index";
import Product from "./views/Product/index";
import QR from "./views/QR/index";
import Auth from "./views/Auth/index";
import QRScan from "./views/QRScan/index";
import Activation from "./views/Activation/index";
import ChatList from "./views/ChatList/index";
import Chatroom from "./views/ChatRoom/index";
import Cart from "./views/Cart/index";
import MyBooks from "./views/MyBooks/index";
import AR from "./views/AR/index";
class AppRouter extends Component {
constructor(props) {
super(props);
window.router = this;
}
state = {};
componentDidMount() {
if (this.props.profile) {
return;
} else {
this.props.getProfile();
}
}
render() {
let home = (
{proxy.status() ? (
this.props.profile ? (
) : (
)
) : (
)}
);
return (
{home}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{proxy.status() ? (
) : (
)}
{window.innerWidth < 1000 ? (
{proxy.status() ? (
) : (
)}
) : null}
{proxy.status() ? (
) : (
)}
);
}
}
export default connect(
(state) => ({
profile: state.user.status,
// status: state.user.status,
}),
{ getProfile: user.getProfile }
)(AppRouter);