fix naming mistake

This commit is contained in:
Travis Eden 2018-10-28 18:51:51 -04:00
parent 760edeff1f
commit a210644959

View file

@ -2,8 +2,7 @@ const chainquery = require('chainquery');
const db = require('server/models'); const db = require('server/models');
const fetchClaimData = async (params) => { const fetchClaimData = async (params) => {
const name = params.claimName; let { claimId, claimName: name } = params;
let claimId = params.claimId;
if (claimId === 'none') claimId = null; if (claimId === 'none') claimId = null;
const [cq, local] = await Promise.all([ const [cq, local] = await Promise.all([
@ -12,8 +11,8 @@ const fetchClaimData = async (params) => {
]); ]);
if (!cq && !local) return null; if (!cq && !local) return null;
if (cq.name === name && !local) return cq; if (cq && cq.name === name && !local) return cq;
if (local.name === name && !cq) return local; if (local && local.name === name && !cq) return local;
return local.updatedAt > cq.modified_at ? local : cq; return local.updatedAt > cq.modified_at ? local : cq;
}; };