parent
cf527dea86
commit
3bda4d1fc0
15 changed files with 106 additions and 71 deletions
@ -1,40 +1,32 @@ |
||||
import React, { Component } from 'react'; |
||||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; |
||||
import store from './Redux/store'; |
||||
import { Provider } from 'react-redux'; |
||||
|
||||
import proxy from './Redux/proxy'; |
||||
import Home from './views/Home/Home'; |
||||
import ChatRoom from './views/ChatRoom/ChatRoom'; |
||||
import Auth from './views/Auth/Auth'; |
||||
import proxy from './Redux/proxy'; |
||||
export default class AppRouter extends Component { |
||||
// import { connect } from 'react-redux';
|
||||
class AppRouter extends Component { |
||||
constructor(props) { |
||||
super(props); |
||||
window.router = this; |
||||
} |
||||
state = {}; |
||||
render() { |
||||
let home; |
||||
if (proxy.status()) { |
||||
home = ( |
||||
<Route exact path={'/'}> |
||||
<Home /> |
||||
</Route> |
||||
); |
||||
} else { |
||||
home = ( |
||||
<Route exact path={'/'}> |
||||
<Auth /> |
||||
</Route> |
||||
); |
||||
} |
||||
let home = ( |
||||
<Route exact path={'/'}> |
||||
{proxy.status() ? <Home /> : <Auth />} |
||||
</Route> |
||||
); |
||||
|
||||
return ( |
||||
<Provider store={store}> |
||||
<Router> |
||||
<Switch>{home}</Switch> |
||||
<Route exact path={`/chatroom/:id`}> |
||||
<ChatRoom /> |
||||
</Route> |
||||
<Route exact path={'/auth'}> |
||||
<Auth /> |
||||
</Route> |
||||
</Router> |
||||
</Provider> |
||||
<Router> |
||||
<Switch>{home}</Switch> |
||||
<Route exact path={`/chatroom/:id`}> |
||||
<ChatRoom /> |
||||
</Route> |
||||
</Router> |
||||
); |
||||
} |
||||
} |
||||
|
||||
export default AppRouter; //connect((state) => ({ isLogin: state.user.isLogin }), {})(AppRouter);
|
||||
|
@ -0,0 +1,3 @@ |
||||
// import { createBrowserHistory } from 'history';
|
||||
|
||||
// export default createBrowserHistory();
|
Loading…
Reference in new issue