-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAnalytics.js
More file actions
49 lines (41 loc) · 1.1 KB
/
Analytics.js
File metadata and controls
49 lines (41 loc) · 1.1 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
42
43
44
45
46
47
48
49
import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import {changePageTitle} from '../Layout/Actions/LayoutActions';
import Analytic from "../Analytic/Analytic";
class AnalyticsPage extends Component {
constructor() {
super();
}
componentWillMount() {
const {title} = AnalyticsPage.getPageMeta();
this.props.changePageTitle(title);
}
componentDidMount() {
if (!this.props.loggedIn) {
window.location.href = '/login'
}
}
static getPageMeta() {
return {
title: `Analytics | Data Skeptic`
}
}
render() {
const { user, loggedIn } = this.props
return loggedIn && (
<div className="center">
<Analytic />
</div>
)
}
}
export default connect(
(state) => ({
user: state.auth.getIn(['user']).toJS(),
loggedIn: state.auth.getIn(['loggedIn']),
}),
(dispatch) => bindActionCreators({
changePageTitle
}, dispatch)
)(AnalyticsPage);