import React from 'react'; import update from 'immutability-helper'; import { me } from '../api'; import { UserType } from './Types'; import Button from './Button'; import Icon from './Icon'; export default class Settings extends React.Component { constructor(props) { super(props); this.state = { settings: {}, me: {} }; } componentDidMount() { me().then(visitor => { this.setState({ me: visitor }); }); } onSubmitAvatar = (event) => { if (event.preventDefault) { event.preventDefault(); } console.log('avatar update'); } passwordChanged = (event) => { this.setState({ settings: { password: event.target.value } }); } onSubmitPassword = (event) => { if (event.preventDefault) { event.preventDefault(); } console.log('password update'); } emailChanged = (event) => { let newState = update(this.state, { me: { activeEmail: { $set: event.target.value } } }); this.setState(newState); console.log('email update'); } disableTelegram = () => { console.log('telegram disable'); } disableFacebook = (event) => { if (event.preventDefault) { event.preventDefault(); } console.log('facebook disable'); } enableFacebook = (event) => { if (event.preventDefault) { event.preventDefault(); } console.log('facebook enable'); } disableTwitter = () => { console.log('twitter disable'); } render() { const { me } = this.state; return (