import React, { Component } from 'react' import { Link } from 'react-router-dom' import { session } from 'app/session' import actions from 'app/actions' import { capitalize } from 'app/utils' import { TextInput, LabelDescription, Select, TextArea, Checkbox, SubmitButton, Loader, FileInputField } from 'app/common' export default class MediaFileForm extends Component { state = { img: null, } constructor(props) { super(props) this.handleSelect = this.handleSelect.bind(this) this.handleChange = this.handleChange.bind(this) this.handleSettingsChange = this.handleSettingsChange.bind(this) this.handleUpload = this.handleUpload.bind(this) } handleChange(e) { const { name, value } = e.target this.handleSelect(name, value) } handleSelect(name, value) { this.props.onSelect(name, value) } handleSettingsChange(name, value) { this.props.onSettingsChange(name, value) } handleUpload(file) { console.log('uploading file') const uploadData = { image: file, tag: "file", username: 'animism', } // uploadData['__image_filename'] = file.filename return actions.upload.upload(uploadData).then(data => { this.handleSettingsChange("file", data.res) }) } render() { const { data } = this.props console.log(data.settings) return (