import React from 'react'; function UrlMiddle ({publishToChannel, loggedInChannelName, loggedInChannelShortId}) { if (publishToChannel) { if (loggedInChannelName) { return {loggedInChannelName}:{loggedInChannelShortId} /; } return @channelSelect a channel below /; } return ( xyzThis will be a random id / ); } class UrlChooser extends React.Component { constructor (props) { super(props); this.state = { error : null, host : 'spee.ch', urlMiddle: null, }; this.handleInput = this.handleInput.bind(this); this.checkClaimIsAvailable = this.checkClaimIsAvailable.bind(this); } handleInput (event) { event.preventDefault(); let value = event.target.value; const name = event.target.name; value = this.props.cleanseInput(value); this.props.updateUploaderState(name, value); this.checkClaimIsAvailable(value); } checkClaimIsAvailable (claim) { const that = this; this.props.makeGetRequest(`/api/claim-is-available/${claim}`) .then(() => { that.setState({'error': null}); }) .catch((error) => { that.setState({'error': error.message}); }); } render () { return (
{this.state.error}