Skip to content

Commit

Permalink
update deps and improve sample login (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jussi Vatjus-Anttila authored Dec 6, 2018
1 parent d7798a9 commit 2c452c8
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 120 deletions.
170 changes: 56 additions & 114 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"dependencies": {
"axios": "^0.18.0",
"bluebird": "^3.5.2",
"debug": "^4.0.1",
"debug": "^4.1.0",
"invariant": "^2.2.4",
"lodash": "^4.17.11",
"socket.io-client": "^2.1.1"
"socket.io-client": "^2.2.0"
},
"devDependencies": {
"babel-helper-evaluate-path": "^0.5.0",
Expand All @@ -62,6 +62,6 @@
"mocha-headless-chrome": "^2.0.0",
"moxios": "^0.4.0",
"sinon": "^6.3.4",
"socket.io": "^2.1.1"
"socket.io": "^2.2.0"
}
}
15 changes: 12 additions & 3 deletions sample/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ const {Authentication, Transport} = require('../src');

const transport = new Transport('http://localhost:3000');
const auth = new Authentication(transport);
auth.loginWithToken(process.env.GITHUB_ACCESS_TOKEN)
const token = process.env.GITHUB_ACCESS_TOKEN;
const email = process.argv[1];
const password = process.argv[2];
let login;
if (token) {
login = auth.loginWithToken(token);
} else {
login = auth.login(email, password);
}
login
.then(() => {
console.log('login success');
console.log(`login success, token: ${transport.token}`);
})
.catch((error) => {
console.error(`login fails: ${error}`);
})
});

0 comments on commit 2c452c8

Please sign in to comment.