0

I'm getting the error await is only valid in async function. I find this weird as I took the code of the docs itself.

Why would this throw the error?

const OpTrade = require('trade-opskins-api')
const OPSKINS_API_KEY = 'key';

const opTrade = new OpTrade(OPSKINS_API_KEY);
const interface = 'user'; // item | trade | user
const method = 'GetProfile';

// const response = await opTrade.userGetProfile() 
// or
const response = await opTrade[interface + method]()

console.log(JSON.stringify(response, null, 2));
CS-CASES. org
  • 23
  • 1
  • 6

0 Answers0