-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.jsx
63 lines (55 loc) · 1.51 KB
/
App.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import { Router, Route, Link, browserHistory, IndexRoute } from 'react-router'
import Aboutus from './components/AboutUs.jsx'
import Login from './components/Login.jsx'
import LoginSuccess from './components/LoginSuccess.jsx'
import {connect} from 'react-redux';
import {getInfo} from './actions/actions.js'
var App = React.createClass({
componentDidMount: function() {
this.props.getInfo();
},
render() {
return (
<div >
<div className="container-fluid parentContainer">
{this.props["loginSuccess"]["success"]?
(<div><LoginSuccess /></div>)
:
(
<div className="row">
<div className="col-sm-1">
<Link to="/aboutus">
<input type="button" className="btn-default btn" value="About Us" />
</Link>
</div>
<div className="col-sm-1">
<Link to="/login">
<input type="button" className="btn-default btn" value="Login" />
</Link>
</div>
</div>
)}
<div className="row">
<div className="col-sm-12">
<h1>{this.props.children && React.cloneElement(this.props.children,{data: this.props , dispatch:this.props.dispatch }) }</h1>
</div>
</div>
</div>
</div>
);
}
})
const mapStateToProps = (state) => {
return {
basic : state.basic.info,
loginSuccess : state.basic["loginInfo"]|| ""
}
}
const mapDispatchToProps = (dispatch) => {
return {
getInfo : ()=>{ dispatch(getInfo()) }
}
}
const MyApp = connect(mapStateToProps, mapDispatchToProps)(App);
export default MyApp;