updated channel creation to check name availability directly
This commit is contained in:
parent
6297faac79
commit
bbd455f4a1
1 changed files with 5 additions and 3 deletions
|
@ -45,6 +45,10 @@ class ChannelCreateForm extends React.Component {
|
||||||
this.setState({'error': error.message});
|
this.setState({'error': error.message});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
checkIsChannelAvailable (channel) {
|
||||||
|
const channelWithAtSymbol = `@${channel}`;
|
||||||
|
return request(`/api/channel/availability/${channelWithAtSymbol}`);
|
||||||
|
}
|
||||||
checkIsPasswordProvided () {
|
checkIsPasswordProvided () {
|
||||||
const password = this.state.password;
|
const password = this.state.password;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -77,9 +81,7 @@ class ChannelCreateForm extends React.Component {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.checkIsPasswordProvided()
|
this.checkIsPasswordProvided()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (this.state.error) {
|
return this.checkIsChannelAvailable();
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.setState({status: 'We are publishing your new channel. Sit tight...'});
|
this.setState({status: 'We are publishing your new channel. Sit tight...'});
|
||||||
|
|
Loading…
Reference in a new issue