import React from 'react';
function ChannelSuccess (message) {
return (
);
}
function ChannelInProgress () {
return (
Creating your new channel. This may take a few seconds...
);
}
class ChannelCreateForm extends React.Component {
constructor (props) {
super(props);
this.state = {
error : null,
channel : null,
password: null,
status : null,
};
this.handleChannelInput = this.handleChannelInput.bind(this);
this.handleInput = this.handleInput.bind(this);
this.checkChannelIsAvailable = this.checkChannelIsAvailable.bind(this);
this.createChannel = this.createChannel.bind(this);
}
handleChannelInput (event) {
event.preventDefault();
const name = event.target.name;
let value = event.target.value;
value = this.props.cleanseInput(value);
this.setState({[name]: value});
this.checkChannelIsAvailable(value);
}
handleInput (event) {
event.preventDefault();
const name = event.target.name;
const value = event.target.value;
this.setState({[name]: value});
}
checkChannelIsAvailable (channel) {
const that = this;
this.props.makeGetRequest(`/api/channel-is-available/${channel}`)
.then(() => {
that.setState({urlError: null});
})
.catch((error) => {
that.setState({error: error.message});
});
}
createChannel (event) {
event.preventDefault();
// publishNewChannel(event)
}
render () {
return (
);
}
}
module.exports = ChannelCreateForm;