Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not return any rates #12

Open
madmacc opened this issue Aug 2, 2022 · 0 comments
Open

Does not return any rates #12

madmacc opened this issue Aug 2, 2022 · 0 comments

Comments

@madmacc
Copy link

madmacc commented Aug 2, 2022

oxr.timestamp undefined
oxr.base USD
oxr.rates {}

const oxr = require('open-exchange-rates');
oxr.set({ app_id: OXR_APP_ID })

await oxr.latest();
  // You can now use `oxr.rates`, `oxr.base` and `oxr.timestamp`
  console.log('oxr.rates', oxr.rates);
  console.log('oxr.base', oxr.base);
  console.log('oxr.timestamp', oxr.timestamp);

Using version 0.3.0
My app id works fine using:
https://openexchangerates.org/api/latest.json?app_id=

UPDATE:
It appears it doesn't work with "await".
The following works but I am not sure how to use it like that for my use case as I need to wait for the results and then do something else.

 oxr.latest(function() {
    // You can now use `oxr.rates`, `oxr.base` and `oxr.timestamp`
    console.log('oxr', oxr);
    console.log('oxr.rates', oxr.rates);
    console.log('oxr.base', oxr.base);
    console.log('oxr.timestamp', oxr.timestamp);
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant