fix: missing return, api headers, variable name

This commit is contained in:
Rafael Taranto 2024-05-29 14:42:39 +01:00
parent d4abde7c8f
commit 8837da0b56
2 changed files with 9 additions and 5 deletions

View file

@ -31,8 +31,12 @@ function rate (account, objectType, cryptoCode, objectId) {
coin: "ALL"
}
return axios.post(`https://api.scorechain.com/v1/scoringAnalysis`, payload, { headers: { 'X-API-KEY': account.apiKey }
})
const headers = {
'accept': 'application/json',
'X-API-KEY': account.apiKey,
'Content-Type': 'application/json'
}
return axios.post(`https://api.scorechain.com/v1/scoringAnalysis`, payload, { headers })
.then(res => {
const resScore = res.data?.analysis?.assigned?.result?.score
if (!resScore) throw new Error('Failed to get score from Scorechain API')
@ -46,11 +50,11 @@ function rate (account, objectType, cryptoCode, objectId) {
}
function rateTransaction (account, cryptoCode, transactionId) {
rate(account, TYPE.TRANSACTION, cryptoCode, transactionId)
return rate(account, TYPE.TRANSACTION, cryptoCode, transactionId)
}
function rateAddress (account, cryptoCode, address) {
rate(account, TYPE.ADDRESS, cryptoCode, address)
return rate(account, TYPE.ADDRESS, cryptoCode, address)
}
function isWalletScoringEnabled (account, cryptoCode) {

View file

@ -12,7 +12,7 @@ export default {
title: 'Scorechain (Scoring)',
elements: [
{
code: 'apikey',
code: 'apiKey',
display: 'API Key',
component: SecretInputFormik
},