diff --git a/controllers/serveController.js b/controllers/serveController.js index 07825684..50403a16 100644 --- a/controllers/serveController.js +++ b/controllers/serveController.js @@ -112,7 +112,7 @@ module.exports = { return new Promise((resolve, reject) => { db.getLongClaimId(claimName, claimId) // 1. get the long claim id .then(result => { // 2. get the asset using the long claim id - if (result === NO_CLAIM || !result) { + if (result === NO_CLAIM) { resolve(NO_CLAIM); return; } @@ -129,7 +129,7 @@ module.exports = { return new Promise((resolve, reject) => { db.getLongChannelId(channelName, channelId) // 1. get the long channel id .then(result => { // 2. get the long claim Id - if (result === NO_CHANNEL || !result) { + if (result === NO_CHANNEL) { resolve(NO_CHANNEL); return; } @@ -140,9 +140,6 @@ module.exports = { if (result === NO_CHANNEL || result === NO_CLAIM) { resolve(result); return; - } else if (!result) { - resolve(NO_CLAIM); - return; } resolve(getAssetByLongClaimId(result, claimName)); }) diff --git a/models/index.js b/models/index.js index ac152c70..192cece9 100644 --- a/models/index.js +++ b/models/index.js @@ -73,7 +73,7 @@ function getTopFreeClaimIdByClaimName (name) { .then(result => { switch (result.length) { case 0: - return resolve(null); + return resolve(NO_CLAIM); default: return resolve(result[0].claimId); }