import React from "react"; import { Grid, Divider, Button, Label, Responsive } from "semantic-ui-react"; import { Segment, Image } from "semantic-ui-react"; import { RemoteService } from "../remote"; import { withRouter } from "react-router-dom"; import { connect } from "react-redux"; const IconHomeImage = () => ( ); const TitleImage = () => ; export class MyHeader extends React.Component { constructor(props) { super(props); this.state = { username: "", }; this.getInfo(); this.logout = this.logout.bind(this); } logout() { this.props.logout().then(() => this.props.history.push("/")); } getInfo() { this.props .fetchUserInfo() .catch((err) => console.error("MyHeader fetch user info error", err)); } render() { return (
); } } const mapStateToProps = (state, _) => ({ username: state.userInfo && state.userInfo.username ? state.userInfo.username : "", }); const LoginContainer = connect( mapStateToProps, RemoteService )(withRouter(MyHeader)); export default LoginContainer;