Publish: wait for new channel to appear before updating list
This commit is contained in:
parent
f91653ff2d
commit
b599e5343c
1 changed files with 19 additions and 13 deletions
|
@ -7,6 +7,16 @@ import Modal from '../component/modal.js';
|
||||||
var PublishPage = React.createClass({
|
var PublishPage = React.createClass({
|
||||||
_requiredFields: ['name', 'bid', 'meta_title', 'meta_author', 'meta_license', 'meta_description'],
|
_requiredFields: ['name', 'bid', 'meta_title', 'meta_author', 'meta_license', 'meta_description'],
|
||||||
|
|
||||||
|
_updateChannelList: function(channel) {
|
||||||
|
// Calls API to update displayed list of channels. If a channel name is provided, will select
|
||||||
|
// that channel at the same time (used immediately after creating a channel)
|
||||||
|
lbry.channel_list_mine().then((channels) => {
|
||||||
|
this.setState({
|
||||||
|
channels: channels,
|
||||||
|
... channel ? {channel} : {}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
handleSubmit: function(event) {
|
handleSubmit: function(event) {
|
||||||
if (typeof event !== 'undefined') {
|
if (typeof event !== 'undefined') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -282,15 +292,15 @@ var PublishPage = React.createClass({
|
||||||
creatingChannel: true,
|
creatingChannel: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
lbry.channel_new({channel_name: this.state.newChannelName, amount: parseInt(this.state.newChannelBid)}).then(() => {
|
const newChannelName = this.state.newChannelName;
|
||||||
this.setState({
|
lbry.channel_new({channel_name: newChannelName, amount: parseInt(this.state.newChannelBid)}).then(() => {
|
||||||
creatingChannel: false,
|
setTimeout(() => {
|
||||||
});
|
this.setState({
|
||||||
|
creatingChannel: false,
|
||||||
|
});
|
||||||
|
|
||||||
this.forceUpdate();
|
this._updateChannelList(newChannelName);
|
||||||
this.setState({
|
}, 5000);
|
||||||
channel: name,
|
|
||||||
});
|
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
// TODO: add error handling
|
// TODO: add error handling
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -308,11 +318,7 @@ var PublishPage = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
lbry.channel_list_mine().then((channels) => {
|
this._updateChannelList();
|
||||||
this.setState({
|
|
||||||
channels: channels,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
document.title = "Publish";
|
document.title = "Publish";
|
||||||
|
|
Loading…
Reference in a new issue