import React from "react";
import {
Grid,
Divider,
Button,
Label,
Responsive,
Checkbox,
} 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.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));
}
setCameraEnabled(val) {
let enabled = {
cameraEnabled: val,
};
this.props
.userPermissions(enabled)
.then(() => this.getInfo())
.catch((err) => console.error("Camera enabled", err));
}
render() {
return (
Share cameras}
checked={this.props.cameraEnabled}
toggle
onChange={(e, val) => this.setCameraEnabled(val.checked)}
/>
Share cameras}
checked={this.props.cameraEnabled}
toggle
onChange={(e, val) => this.setCameraEnabled(val.checked)}
/>
);
}
}
const mapStateToProps = (state, _) => ({
username:
state.userInfo && state.userInfo.username ? state.userInfo.username : "",
cameraEnabled: state.userInfo ? state.userInfo.cameraEnabled : false,
});
const LoginContainer = connect(
mapStateToProps,
RemoteService
)(withRouter(MyHeader));
export default LoginContainer;