import React from 'react'; import AddFriendContainer from '../friend_request/add_friend_container'; class CoverPicture extends React.Component{ constructor(props){ super(props); this.state = {imageFile:null,imageUrl:null}; this.updateFile =this.updateFile.bind(this); } updateFile(e) { const file = e.currentTarget.files[0]; const fileReader = new FileReader(); const formData = new FormData(); fileReader.onloadend = function () { this.setState({ imageFile: file, imageUrl: fileReader.result }); }.bind(this); if (file) { fileReader.readAsDataURL(file); formData.append("user[cover_image_url]", file); formData.append("user[id]", this.props.currentUser.id); this.props.updateUser(formData); } } updateCoverPhoto(){ if (this.props.currentUser.id === this.props.user.id){ return(