Convert Publish page to use <form>

Previously used form element only for file input
This commit is contained in:
Alex Liebowitz 2016-10-18 22:30:57 -04:00
parent 48d30a5cb7
commit eba4dbe146

View file

@ -250,8 +250,10 @@ var PublishPage = React.createClass({
});
})
var formData = new FormData(fileInput.form);
formData.append('file', fileInput.files[0]);
xhr.open('POST', '/upload', true);
xhr.send(new FormData(fileInput.form));
xhr.send(formData);
}
},
handleFeePrefChange: function(feeEnabled) {
@ -320,6 +322,7 @@ var PublishPage = React.createClass({
render: function() {
return (
<main ref="page">
<form onSubmit={this.handleSubmit}>
<section className="card">
<h4>LBRY Name</h4>
<div className="form-row">
@ -336,7 +339,6 @@ var PublishPage = React.createClass({
<section className="card">
<h4>Choose File</h4>
<form>
<FormField name="file" ref="file" type="file" onChange={this.handleFileChange} />
{ !this.state.fileInfo ? '' :
(!this.state.tempFileReady ? <div>
@ -344,7 +346,6 @@ var PublishPage = React.createClass({
{!this.state.uploaded ? <span> Importing file into LBRY...</span> : <span> Processing file...</span>}
</div>
: <div>File ready for publishing!</div>) }
</form>
{ this.state.myClaimExists ? <div className="help">If you don't choose a file, the file from your existing claim will be used.</div> : null }
</section>
@ -456,6 +457,7 @@ var PublishPage = React.createClass({
<Link button="primary" label={!this.state.submitting ? 'Publish' : 'Publishing...'} onClick={this.handleSubmit} disabled={this.state.submitting} />
<Link button="cancel" href="/" label="Cancel"/>
</div>
</form>
</main>
);
}