fix: misusing promises

This commit is contained in:
Rafael Taranto 2024-06-04 14:31:00 +01:00
parent 8837da0b56
commit 52676b8603

View file

@ -20,7 +20,8 @@ const TYPE = {
} }
function rate (account, objectType, cryptoCode, objectId) { function rate (account, objectType, cryptoCode, objectId) {
if (!isWalletScoringEnabled(account, cryptoCode)) return Promise.resolve(null) return isWalletScoringEnabled(account, cryptoCode).then(isEnabled => {
if (!isEnabled) return Promise.resolve(null)
const threshold = account.scoreThreshold const threshold = account.scoreThreshold
const payload = { const payload = {
@ -47,6 +48,7 @@ function rate (account, objectType, cryptoCode, objectId) {
.catch(err => { .catch(err => {
throw err throw err
}) })
})
} }
function rateTransaction (account, cryptoCode, transactionId) { function rateTransaction (account, cryptoCode, transactionId) {