zoib
v2.2.1
Published
``` js const ZOIB = require("zoib");
Downloads
5
Readme
Usage
const ZOIB = require("zoib");
const zoibUrl = 'https://zoib.digitalairways.com:443';
const zoibLogin = '<login>';
const zoibPassword = '<password>';
const zoib = new ZOIB(zoibUrl, zoibLogin, zoibPassword);
let tokens = [];
console.log(zoib.isLogged()); // false
zoib.login()
.then(_ => {
console.log(zoib.isLogged()); // true
return zoib.getTokens();
})
.then(data => {
tokens = data;
return true;
})
.then(_ => {
// do what you want with your tokens
// but when you are finished with them, push them back
return zoib.pushTokens(tokens);
})
.catch(e) {
console.error(e);
})
.finally(_ => {
if(zoib.isLogged()){
zoib.logout().then().catch()
}
})