disease-sh/node-api

Difference result for .countries() and .historical()

Closed this issue · 3 comments

The code

import React, { Component } from 'react'
import { NovelCovid } from "novelcovid";

const covid = new NovelCovid();

export class Test extends Component {
 async componentDidMount(){
   const country = await covid.countries('usa')
   const history = await covid.historical(null, 'usa')
   console.log(country.deaths)
   const deaths = history.timeline.deaths
   console.log(deaths)
 } 
  render() {
    return (
      <div>

      </div>
    )
  }
}

export default Test

give two different result:
usa

I tried the same thing with 'russia', but it gives correct result
russia

They have added made few changes to the api. Yet to implement those but the above this is weird. using countries returns interface Country where deaths is a number ? but above it shows object ? are you sure the first image is correct ? and not of some other country ? I will update this tonight

I am not sure what you mean. I am console logging 2 things, country.deaths and history.timeline.deaths. The most recent value (with key "4/12/20") of history.timeline.deaths is different than country.deaths. Shouldn't they be the same?

my bad, didnt know it was actually from 2 different sources. I will close this.