zoib

2.2.1 • Public • Published

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()
    }
})

Readme

Keywords

none

Package Sidebar

Install

npm i zoib

Weekly Downloads

8

Version

2.2.1

License

none

Unpacked Size

11.1 kB

Total Files

7

Last publish

Collaborators

  • thethingbox