diff --git a/react/components/channelSelector.jsx b/react/components/channelSelector.jsx
index e3f73c6e..84fa1e9e 100644
--- a/react/components/channelSelector.jsx
+++ b/react/components/channelSelector.jsx
@@ -33,7 +33,7 @@ class ChannelSelector extends React.Component {
constructor (props) {
super(props);
this.state = {
- displayCreateOrLogin: LOGIN,
+ displayCreateOrLogin: null,
};
this.toggleCreateOrLogin = this.toggleCreateOrLogin.bind(this);
}
@@ -41,8 +41,10 @@ class ChannelSelector extends React.Component {
const selectedOption = event.target.selectedOptions[0].value;
if (selectedOption === 'login') {
this.setState({ displayCreateOrLogin: LOGIN });
- } else {
+ } else if (selectedOption === 'create') {
this.setState({ displayCreateOrLogin: CREATE });
+ } else {
+ this.setState({ displayCreateOrLogin: null });
}
}
render () {
@@ -57,13 +59,14 @@ class ChannelSelector extends React.Component {
- { (this.state.displayCreateOrLogin === LOGIN) ? : }
+ { (this.state.displayCreateOrLogin === LOGIN) && }
+ { (this.state.displayCreateOrLogin === CREATE) && }
)}
diff --git a/react/components/publishForm.jsx b/react/components/publishForm.jsx
index 567a174c..78c9289d 100644
--- a/react/components/publishForm.jsx
+++ b/react/components/publishForm.jsx
@@ -97,7 +97,7 @@ class PublishForm extends React.Component {
{
- if (xhttp.readyState == 4 ) {
- if ( xhttp.status == 200) {
+ if (xhttp.readyState === 4) {
+ if (xhttp.status === 200) {
resolve(xhttp.response);
- } else if (xhttp.status == 403) {
+ } else if (xhttp.status === 403) {
reject('Wrong channel name or password');
} else {
reject('request failed with status:' + xhttp.status);
@@ -92,6 +93,21 @@ class Uploader extends React.Component {
name = name.replace(/[^A-Za-z0-9-]/g, ''); // remove all characters that are not A-Z, a-z, 0-9, or '-'
return name;
}
+ getCookie (cname) {
+ const name = cname + '=';
+ const decodedCookie = decodeURIComponent(document.cookie);
+ const ca = decodedCookie.split(';');
+ for (let i = 0; i < ca.length; i++) {
+ let c = ca[i];
+ while (c.charAt(0) === ' ') {
+ c = c.substring(1);
+ }
+ if (c.indexOf(name) === 0) {
+ return c.substring(name.length, c.length);
+ }
+ }
+ return '';
+ }
render () {
return (