fixed publish form because it was not reset on success

This commit is contained in:
bill bittner 2018-02-26 16:34:02 -08:00
parent 0c0d463d86
commit cdf567e8ee
2 changed files with 13 additions and 16 deletions

View file

@ -5,39 +5,39 @@ import * as publishStates from 'constants/publish_claim_states';
function PublishStatus ({ status, message }) {
return (
<div className="row row--tall flex-container--column flex-container--center-center">
<div className='row row--tall flex-container--column flex-container--center-center'>
{(status === publishStates.LOAD_START) &&
<div className="row align-content-center">
<div className='row align-content-center'>
<p>File is loading to server</p>
<p className="blue">{message}</p>
<p className='blue'>{message}</p>
</div>
}
{(status === publishStates.LOADING) &&
<div>
<div className="row align-content-center">
<div className='row align-content-center'>
<p>File is loading to server</p>
<p className="blue">{message}</p>
<p className='blue'>{message}</p>
</div>
</div>
}
{(status === publishStates.PUBLISHING) &&
<div className="row align-content-center">
<div className='row align-content-center'>
<p>Upload complete. Your file is now being published on the blockchain...</p>
<ProgressBar size={12} />
<p>Curious what magic is happening here? <a className="link--primary" target="blank" href="https://lbry.io/faq/what-is-lbry">Learn more.</a></p>
<p>Curious what magic is happening here? <a className='link--primary' target='blank' href='https://lbry.io/faq/what-is-lbry'>Learn more.</a></p>
</div>
}
{(status === publishStates.SUCCESS) &&
<div className="row align-content-center">
<div className='row align-content-center'>
<p>Your publish is complete! You are being redirected to it now.</p>
<p>If you are not automatically redirected, <a className="link--primary" target="_blank" href={message}>click here.</a></p>
<p>If you are not automatically redirected, <a className='link--primary' target='_blank' href={message}>click here.</a></p>
</div>
}
{(status === publishStates.FAILED) &&
<div className="row align-content-center">
<div className='row align-content-center'>
<p>Something went wrong...</p>
<p><strong>{message}</strong></p>
<p>For help, post the above error text in the #speech channel on the <a className="link--primary" href="https://discord.gg/YjYbwhS" target="_blank">lbry discord</a></p>
<p>For help, post the above error text in the #speech channel on the <a className='link--primary' href='https://discord.gg/YjYbwhS' target='_blank'>lbry discord</a></p>
</div>
}
</div>

View file

@ -72,7 +72,7 @@ class PublishForm extends React.Component {
console.log('publish response:', response);
if ((xhr.status === 200) && response.success) {
this.props.history.push(`/${response.data.claimId}/${response.data.name}`);
this.props.onPublishStatusChange(publishStates.SUCCESS, response.data.url);
this.props.onFileClear();
} else {
this.props.onPublishStatusChange(publishStates.FAILED, response.message);
}
@ -119,9 +119,6 @@ class PublishForm extends React.Component {
// publish the claim
return this.makePublishRequest(this.props.file, metadata);
})
.then(() => {
this.props.onPublishStatusChange('publish request made');
})
.catch((error) => {
this.props.onPublishSubmitError(error.message);
});