-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathLogout.js
More file actions
44 lines (37 loc) · 963 Bytes
/
Logout.js
File metadata and controls
44 lines (37 loc) · 963 Bytes
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
import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import {changePageTitle} from '../Layout/Actions/LayoutActions';
class Logout extends Component {
componentWillMount() {
const {title} = Logout.getPageMeta();
this.props.changePageTitle(title);
}
componentDidMount() {
if (this.props.loggedIn) {
window.location.href = '/api/v1/auth/logout'
} else {
window.location.href = '/'
}
}
static getPageMeta() {
return {
title: `Logout | Data Skeptic`
}
}
render() {
return (
<div className="center">
...
</div>
)
}
}
export default connect(
(state) => ({
loggedIn: state.auth.getIn(['loggedIn'])
}),
(dispatch) => bindActionCreators({
changePageTitle
}, dispatch)
)(Logout);