added claim availability check for channels via saga

This commit is contained in:
bill bittner 2018-05-03 22:51:01 -07:00
parent 9a7fdf4834
commit 52f2416d88

View file

@ -8,9 +8,16 @@ const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
*/
function addAtSymbolIfNecessary (name) {
if (name.substring(0,1) !== '@') {
return `@${name}`;
}
return name;
}
const channelAvailability = ({ ip, originalUrl, params: { name } }, res) => {
const gaStartTime = Date.now();
let name = `@${name}`;
name = addAtSymbolIfNecessary(name);
checkChannelAvailability(name)
.then(isAvailable => {
let responseObject = {