Compare commits
2 Commits
087526d1c6
...
1f41ec6a12
Author | SHA1 | Date |
---|---|---|
Gorji | 1f41ec6a12 | 4 years ago |
Gorji | 3bda4d1fc0 | 4 years ago |
15 changed files with 107 additions and 71 deletions
@ -1,40 +1,32 @@ |
|||||||
import React, { Component } from 'react'; |
import React, { Component } from 'react'; |
||||||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; |
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; |
||||||
import store from './Redux/store'; |
import proxy from './Redux/proxy'; |
||||||
import { Provider } from 'react-redux'; |
|
||||||
|
|
||||||
import Home from './views/Home/Home'; |
import Home from './views/Home/Home'; |
||||||
import ChatRoom from './views/ChatRoom/ChatRoom'; |
import ChatRoom from './views/ChatRoom/ChatRoom'; |
||||||
import Auth from './views/Auth/Auth'; |
import Auth from './views/Auth/Auth'; |
||||||
import proxy from './Redux/proxy'; |
// import { connect } from 'react-redux';
|
||||||
export default class AppRouter extends Component { |
class AppRouter extends Component { |
||||||
|
constructor(props) { |
||||||
|
super(props); |
||||||
|
window.router = this; |
||||||
|
} |
||||||
|
state = {}; |
||||||
render() { |
render() { |
||||||
let home; |
let home = ( |
||||||
if (proxy.status()) { |
|
||||||
home = ( |
|
||||||
<Route exact path={'/'}> |
<Route exact path={'/'}> |
||||||
<Home /> |
{proxy.status() ? <Home /> : <Auth />} |
||||||
</Route> |
</Route> |
||||||
); |
); |
||||||
} else { |
|
||||||
home = ( |
|
||||||
<Route exact path={'/'}> |
|
||||||
<Auth /> |
|
||||||
</Route> |
|
||||||
); |
|
||||||
} |
|
||||||
return ( |
return ( |
||||||
<Provider store={store}> |
|
||||||
<Router> |
<Router> |
||||||
<Switch>{home}</Switch> |
<Switch>{home}</Switch> |
||||||
<Route exact path={`/chatroom/:id`}> |
<Route exact path={`/chatroom/:id`}> |
||||||
<ChatRoom /> |
<ChatRoom /> |
||||||
</Route> |
</Route> |
||||||
<Route exact path={'/auth'}> |
|
||||||
<Auth /> |
|
||||||
</Route> |
|
||||||
</Router> |
</Router> |
||||||
</Provider> |
|
||||||
); |
); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
|
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