-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddbutton.js
More file actions
41 lines (39 loc) · 1.04 KB
/
Copy pathaddbutton.js
File metadata and controls
41 lines (39 loc) · 1.04 KB
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
import React from 'react';
import { Link } from 'react-router';
import { connect } from 'react-redux';
import { checkUserStatus } from './actions/actions';
const AddButton = React.createClass({
componentDidMount: function(){
const { dispatch, isauthenticated } = this.props;
if(isauthenticated === null)
dispatch(checkUserStatus());
},
render: function(){
const { isauthenticated } = this.props;
if(isauthenticated){
return(
<div>
<Link className="w3-btn w3-teal w3-round-xxlarge w3-right w3-half" to="/addapartment/">
<i className="fa fa-plus"> </i>
add your listing
</Link>
</div>
);
}else{
return(
<div>
<a className="w3-btn w3-teal w3-round-xxlarge w3-right" href="/accounts/signup/">
<i className="fa fa-user-plus"> </i>
sign up to add listing
</a>
</div>
);
}
}
});
function mapStateToProps(state){
return{
isauthenticated : state.isauthenticated
}
}
export default connect(mapStateToProps)(AddButton);