React/Redux - publish component #323

Merged
bones7242 merged 80 commits from react-upload into master 2018-01-25 22:43:20 +01:00
4 changed files with 102 additions and 54 deletions
Showing only changes of commit ac5d95f674 - Show all commits

View file

@ -17,7 +17,9 @@ class ChannelCreateForm extends React.Component {
this.cleanseChannelInput = this.cleanseChannelInput.bind(this); this.cleanseChannelInput = this.cleanseChannelInput.bind(this);
this.handleChannelInput = this.handleChannelInput.bind(this); this.handleChannelInput = this.handleChannelInput.bind(this);
this.handleInput = this.handleInput.bind(this); this.handleInput = this.handleInput.bind(this);
this.checkChannelIsAvailable = this.checkChannelIsAvailable.bind(this); this.updateIsChannelAvailable = this.updateIsChannelAvailable.bind(this);
this.checkIsChannelAvailable = this.checkIsChannelAvailable.bind(this);
this.checkIsPasswordProvided = this.checkIsPasswordProvided.bind(this);
this.createChannel = this.createChannel.bind(this); this.createChannel = this.createChannel.bind(this);
} }
cleanseChannelInput (input) { cleanseChannelInput (input) {
@ -30,7 +32,12 @@ class ChannelCreateForm extends React.Component {
let value = event.target.value; let value = event.target.value;
value = this.cleanseChannelInput(value); value = this.cleanseChannelInput(value);
this.setState({channel: value}); this.setState({channel: value});
this.checkChannelIsAvailable(value); if (value) {
this.updateIsChannelAvailable(value);
} else {
this.setState({error: 'Please enter a channel name'});
}
console.log('end of handlechannelinput');
} }
handleInput (event) { handleInput (event) {
event.preventDefault(); event.preventDefault();
@ -38,47 +45,81 @@ class ChannelCreateForm extends React.Component {
const value = event.target.value; const value = event.target.value;
this.setState({[name]: value}); this.setState({[name]: value});
} }
checkChannelIsAvailable (channel) { updateIsChannelAvailable (channel) {
const that = this; const that = this;
makeGetRequest(`/api/channel-is-available/${channel}`) const channelWithAtSymbol = `@${channel}`
.then(() => { makeGetRequest(`/api/channel-is-available/${channelWithAtSymbol}`)
that.setState({urlError: null}); .then(isAvailable => {
if (isAvailable) {
that.setState({'error': null});
} else {
that.setState({'error': 'That channel has already been claimed'});
}
}) })
.catch((error) => { .catch((error) => {
that.setState({error: error.message}); that.setState({'error': error.message});
}); });
} }
validatePassword (password) { checkIsChannelAvailable (channel) {
if (!password || password.length < 1) { const channelWithAtSymbol = `@${channel}`;
throw new Error('Please provide a password'); return new Promise((resolve, reject) => {
makeGetRequest(`/api/channel-is-available/${channelWithAtSymbol}`)
.then(isAvailable => {
if (!isAvailable) {
console.log('channel is not available');
return reject(new Error('That channel has already been claimed'));
} }
console.log('channel is available');
resolve();
})
.catch((error) => {
reject(error);
});
});
}
checkIsPasswordProvided () {
const password = this.state.password;
return new Promise((resolve, reject) => {
if (!password || password.length < 1) {
console.log('password not provided');
return reject(new Error('Please provide a password'));
}
console.log('password provided');
resolve();
});
}
makeCreateChannelRequest (channel, password) {
const params = `username=${channel}&password=${password}`;
return new Promise((resolve, reject) => {
makePostRequest('/signup', params)
.then(result => {
resolve(result);
})
.catch(error => {
console.log('create channel request failed:', error);
reject(new Error('Unfortunately, we encountered an error while creating your channel. Please let us know in Discord!'));
});
});
} }
createChannel (event) { createChannel (event) {
event.preventDefault(); event.preventDefault();
const params = `username=${this.state.channel}&password=${this.state.password}`;
const url = '/signup';
// validate submission data
try {
this.validatePassword(this.state.password);
} catch (error) {
return this.setState({error: error.message});
}
// publish the channel
const that = this; const that = this;
this.setState({status: 'We are publishing your new channel. Sit tight...'}); this.checkIsPasswordProvided()
makePostRequest(url, params) .then(() => {
return that.checkIsChannelAvailable(that.state.channel, that.state.password);
})
.then(() => {
that.setState({status: 'We are publishing your new channel. Sit tight...'});
return that.makeCreateChannelRequest();
})
.then(result => { .then(result => {
that.props.onChannelLogin(result.channelName, result.shortChannelId, result.channelClaimId); that.setState({status: null});
setUserCookies(result.channelName, result.shortChannelId, result.channelClaimId); setUserCookies(result.channelName, result.shortChannelId, result.channelClaimId);
replaceChannelSelectionInNavBar(result.channelName); replaceChannelSelectionInNavBar(result.channelName);
that.props.onChannelLogin(result.channelName, result.shortChannelId, result.channelClaimId);
}) })
.catch(error => { .catch((error) => {
console.log('create channel failure:', error); that.setState({'error': error.message, status: null});
if (error.message) {
this.setState({'error': error.message});
} else {
this.setState({'error': 'Unfortunately, we encountered an error while creating your channel. Please let us know in Discord!'});
}
}); });
} }
render () { render () {
@ -113,7 +154,7 @@ class ChannelCreateForm extends React.Component {
</div> </div>
</form> </form>
) : ( ) : (
<p>{this.state.status}</p> <p className="label">{this.state.status}</p>
)} )}
</div> </div>
); );

View file

@ -22,14 +22,20 @@ class UrlChooser extends React.Component {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
this.setClaimNameFromFileName(); this.setClaimNameFromFileName();
} }
} }
componentWillReceiveProps ({claim: newClaim}) {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
console.log('PublishUrlInput will receive new props (claim)', newClaim);
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
if (newClaim) {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
this.checkClaimIsAvailable(newClaim);
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
} else {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
this.setState({error: 'Please enter a URL'});
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
}
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
}
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
handleInput (event) { handleInput (event) {
event.preventDefault(); event.preventDefault();
let value = event.target.value; let value = event.target.value;
value = this.cleanseInput(value); value = this.cleanseInput(value);
// update the state // update the state
this.props.onClaimChange(value); this.props.onClaimChange(value);
// check to make sure claim name is available
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
this.checkClaimIsAvailable(value);
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
} }
cleanseInput (input) { cleanseInput (input) {
input = input.replace(/\s+/g, '-'); // replace spaces with dashes input = input.replace(/\s+/g, '-'); // replace spaces with dashes
@ -38,7 +44,6 @@ class UrlChooser extends React.Component {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
} }
setClaimNameFromFileName () { setClaimNameFromFileName () {
const fileName = this.props.fileName; const fileName = this.props.fileName;
console.log('setClaimNameFromFileName', fileName);
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
const fileNameWithoutEnding = fileName.substring(0, fileName.lastIndexOf('.')); const fileNameWithoutEnding = fileName.substring(0, fileName.lastIndexOf('.'));
const cleanClaimName = this.cleanseInput(fileNameWithoutEnding); const cleanClaimName = this.cleanseInput(fileNameWithoutEnding);
this.props.onClaimChange(cleanClaimName); this.props.onClaimChange(cleanClaimName);
@ -46,8 +51,12 @@ class UrlChooser extends React.Component {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
checkClaimIsAvailable (claim) { checkClaimIsAvailable (claim) {
const that = this; const that = this;
makeGetRequest(`/api/claim-is-available/${claim}`) makeGetRequest(`/api/claim-is-available/${claim}`)
.then(() => { .then(response => {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
if (response) {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
that.setState({'error': null}); that.setState({'error': null});
} else {
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
that.setState({'error': 'That url has already been claimed'});
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
}
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
}) })
.catch((error) => { .catch((error) => {
that.setState({'error': error.message}); that.setState({'error': error.message});

kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
kauffj commented 2018-01-15 20:29:33 +01:00 (Migrated from github.com)
Review

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).

View file

@ -8,11 +8,11 @@ module.exports = {
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
if (xhttp.readyState === 4) { if (xhttp.readyState === 4) {
if (xhttp.status === 200) { if (xhttp.status === 200) {
resolve(xhttp.response); resolve(xhttp.response);
} else if (xhttp.status === 401) { } if (xhttp.status === 401) {
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
reject('Wrong channel name or password'); reject(new Error('Wrong username or password'));
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
} else { } else {
reject('request failed with status:' + xhttp.status); reject(new Error(xhttp.response));
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
}; }
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
} }
}; };
xhttp.send(); xhttp.send();
@ -28,11 +28,11 @@ module.exports = {
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
if (xhttp.readyState === 4) { if (xhttp.readyState === 4) {
if (xhttp.status === 200) { if (xhttp.status === 200) {
resolve(xhttp.response); resolve(xhttp.response);
} else if (xhttp.status === 401) { } if (xhttp.status === 401) {
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
reject('Wrong channel name or password'); reject(new Error('Wrong username or password'));
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
} else { } else {
reject('request failed with status:' + xhttp.status); reject(new Error(xhttp.response));
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
}; }
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
} }
}; };
xhttp.send(params); xhttp.send(params);

kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.
kauffj commented 2018-01-22 19:36:01 +01:00 (Migrated from github.com)
Review

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

All get and post requests should not assume a 401 means invalid username and password. Instead, have the server pass back the error message. Also, checks for 401 vs. 403 appear to be inconsistent.

View file

@ -90,7 +90,6 @@ module.exports = (app) => {
if (result === true) { if (result === true) {
res.status(200).json(true); res.status(200).json(true);
} else { } else {
// logger.debug(`Rejecting '${params.name}' because that name has already been claimed by this site`);
res.status(200).json(false); res.status(200).json(false);
} }
}) })
@ -105,7 +104,6 @@ module.exports = (app) => {
if (result === true) { if (result === true) {
res.status(200).json(true); res.status(200).json(true);
} else { } else {
// logger.debug(`Rejecting '${params.name}' because that channel has already been claimed`);
res.status(200).json(false); res.status(200).json(false);
} }
}) })