updated route to add the @ for channels

This commit is contained in:
bill bittner 2018-05-03 20:32:54 -07:00
parent 8b808b2c10
commit 9a7fdf4834

View file

@ -10,6 +10,7 @@ const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
const channelAvailability = ({ ip, originalUrl, params: { name } }, res) => { const channelAvailability = ({ ip, originalUrl, params: { name } }, res) => {
const gaStartTime = Date.now(); const gaStartTime = Date.now();
let name = `@${name}`;
checkChannelAvailability(name) checkChannelAvailability(name)
.then(isAvailable => { .then(isAvailable => {
let responseObject = { let responseObject = {
@ -17,9 +18,9 @@ const channelAvailability = ({ ip, originalUrl, params: { name } }, res) => {
data: isAvailable, data: isAvailable,
}; };
if (isAvailable) { if (isAvailable) {
responseObject['message'] = `That channel name is available` responseObject['message'] = `${name} is available`
} else { } else {
responseObject['message'] = `That channel is already in use` responseObject['message'] = `${name} is already in use`
} }
res.status(200).json(responseObject); res.status(200).json(responseObject);
sendGATimingEvent('end-to-end', 'channel name availability', name, gaStartTime, Date.now()); sendGATimingEvent('end-to-end', 'channel name availability', name, gaStartTime, Date.now());