diff options
Diffstat (limited to 'cli/actions.js')
-rw-r--r-- | cli/actions.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/actions.js b/cli/actions.js index 45656a6..065e700 100644 --- a/cli/actions.js +++ b/cli/actions.js | |||
@@ -1,6 +1,7 @@ | |||
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | exports.login = login; | 3 | exports.login = login; |
4 | exports.logout = logout; | ||
4 | exports.put = put; | 5 | exports.put = put; |
5 | exports.get = get; | 6 | exports.get = get; |
6 | exports.del = del; | 7 | exports.del = del; |
@@ -92,6 +93,23 @@ function login(uri) { | |||
92 | }); | 93 | }); |
93 | } | 94 | } |
94 | 95 | ||
96 | function logout() { | ||
97 | checkConfig(); | ||
98 | |||
99 | superagent.post(config.server() + '/api/logout').query(gQuery).end(function (error, result) { | ||
100 | if (result && result.statusCode !== 200) console.log('Failed to logout: ' + result.statusCode); | ||
101 | if (error) console.log(error); | ||
102 | |||
103 | // TODO remove at some point, this is just to clear the previous old version values | ||
104 | config.set('username', ''); | ||
105 | config.set('password', ''); | ||
106 | config.set('server', ''); | ||
107 | config.set('accessToken', ''); | ||
108 | |||
109 | console.log('Done'.green); | ||
110 | }); | ||
111 | } | ||
112 | |||
95 | function put(filePath, otherFilePaths, options) { | 113 | function put(filePath, otherFilePaths, options) { |
96 | checkConfig(); | 114 | checkConfig(); |
97 | 115 | ||