Skip to content

Commit 2c452c8

Browse files
author
Jussi Vatjus-Anttila
authored
update deps and improve sample login (#69)
1 parent d7798a9 commit 2c452c8

File tree

3 files changed

+71
-120
lines changed

3 files changed

+71
-120
lines changed

package-lock.json

Lines changed: 56 additions & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
"dependencies": {
3333
"axios": "^0.18.0",
3434
"bluebird": "^3.5.2",
35-
"debug": "^4.0.1",
35+
"debug": "^4.1.0",
3636
"invariant": "^2.2.4",
3737
"lodash": "^4.17.11",
38-
"socket.io-client": "^2.1.1"
38+
"socket.io-client": "^2.2.0"
3939
},
4040
"devDependencies": {
4141
"babel-helper-evaluate-path": "^0.5.0",
@@ -62,6 +62,6 @@
6262
"mocha-headless-chrome": "^2.0.0",
6363
"moxios": "^0.4.0",
6464
"sinon": "^6.3.4",
65-
"socket.io": "^2.1.1"
65+
"socket.io": "^2.2.0"
6666
}
6767
}

sample/login.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@ const {Authentication, Transport} = require('../src');
22

33
const transport = new Transport('http://localhost:3000');
44
const auth = new Authentication(transport);
5-
auth.loginWithToken(process.env.GITHUB_ACCESS_TOKEN)
5+
const token = process.env.GITHUB_ACCESS_TOKEN;
6+
const email = process.argv[1];
7+
const password = process.argv[2];
8+
let login;
9+
if (token) {
10+
login = auth.loginWithToken(token);
11+
} else {
12+
login = auth.login(email, password);
13+
}
14+
login
615
.then(() => {
7-
console.log('login success');
16+
console.log(`login success, token: ${transport.token}`);
817
})
918
.catch((error) => {
1019
console.error(`login fails: ${error}`);
11-
})
20+
});

0 commit comments

Comments
 (0)