Claim availability check #434
1 changed files with 3 additions and 2 deletions
|
@ -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());
|
||||||
|
|
Loading…
Reference in a new issue