Added redirect to badge page
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
//panels
|
||||
import CommonLinks from '../panels/common_links.jsx';
|
||||
@@ -13,6 +14,12 @@ class BadgeSelect extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.loggedIn) {
|
||||
this.props.history.replace('/login');
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||
this.state.fetch();
|
||||
}
|
||||
@@ -48,4 +55,19 @@ class BadgeSelect extends React.Component {
|
||||
}
|
||||
};
|
||||
|
||||
const mapStoreToProps = (store) => {
|
||||
return {
|
||||
loggedIn: store.account.id !== 0
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
//
|
||||
};
|
||||
};
|
||||
|
||||
BadgeSelect = connect(mapStoreToProps, mapDispatchToProps)(BadgeSelect);
|
||||
|
||||
|
||||
export default BadgeSelect;
|
||||
Reference in New Issue
Block a user