Sup!
So let's start by putting my code and the error I have.
There is my code :
login(token = 'string') {
if (!token) throw "Veuillez entrer un token"
request(
{
url : this.baseURL+this.endpoints[2],
headers : {
"auth" : token
}
},
function (err, response, body) {
// Do more stuff with 'body' here
if (err) throw err
if (body.status == 401) throw "Le token "+token+" est invalide."
this.token = token
return "Logged in with "+token+" as "+body.username
}
);
}
Here is the code I use to test my client:
const c = require('./client/clienttest')
const client = new c()
let t=client.login("APITESTKORO")
console.log(t)
And finally, the thing that logs in the console. It's not that hard, it's just undefined
...
And that's why I need help. I would like to log Logged in with (token) as (username)
instead.
I hope somebody can help me !