diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-07-25 22:01:25 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-07-25 22:01:25 +0200 |
commit | c1e791bad0b079af67398f6407221e6dcbb573dd (patch) | |
tree | 82e5944b4458dd35aa482a38f6b650eb93bb89ad /server/tools | |
parent | 5f7021c33d31c5255b995ae0ff86b5bbea4ea4b9 (diff) | |
download | PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.gz PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.zst PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.zip |
expliciting type checks and predicates (server only)
Diffstat (limited to 'server/tools')
-rw-r--r-- | server/tools/get-access-token.ts | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/server/tools/get-access-token.ts b/server/tools/get-access-token.ts index 66fa70814..d86c84c8d 100644 --- a/server/tools/get-access-token.ts +++ b/server/tools/get-access-token.ts | |||
@@ -2,7 +2,10 @@ import * as program from 'commander' | |||
2 | 2 | ||
3 | import { | 3 | import { |
4 | getClient, | 4 | getClient, |
5 | serverLogin | 5 | serverLogin, |
6 | Server, | ||
7 | Client, | ||
8 | User | ||
6 | } from '../tests/utils/index' | 9 | } from '../tests/utils/index' |
7 | 10 | ||
8 | program | 11 | program |
@@ -19,22 +22,19 @@ if ( | |||
19 | throw new Error('All arguments are required.') | 22 | throw new Error('All arguments are required.') |
20 | } | 23 | } |
21 | 24 | ||
22 | const server = { | ||
23 | url: program['url'], | ||
24 | user: { | ||
25 | username: program['username'], | ||
26 | password: program['password'] | ||
27 | }, | ||
28 | client: { | ||
29 | id: null, | ||
30 | secret: null | ||
31 | } | ||
32 | } | ||
33 | |||
34 | getClient(program.url) | 25 | getClient(program.url) |
35 | .then(res => { | 26 | .then(res => { |
36 | server.client.id = res.body.client_id | 27 | const server = { |
37 | server.client.secret = res.body.client_secret | 28 | url: program['url'], |
29 | user: { | ||
30 | username: program['username'], | ||
31 | password: program['password'] | ||
32 | } as User, | ||
33 | client: { | ||
34 | id: res.body.client_id as string, | ||
35 | secret: res.body.client_secret as string | ||
36 | } as Client | ||
37 | } as Server | ||
38 | 38 | ||
39 | return serverLogin(server) | 39 | return serverLogin(server) |
40 | }) | 40 | }) |