parent
c24a4009c8
commit
9aa9d4452c
@ -25,7 +25,7 @@ var pairs = require('lodash/toPairs')
|
|||||||
var pick = require('lodash/pick')
|
var pick = require('lodash/pick')
|
||||||
var prettyMs = require('pretty-ms')
|
var prettyMs = require('pretty-ms')
|
||||||
var progressStream = require('progress-stream')
|
var progressStream = require('progress-stream')
|
||||||
var Xo = require('xo-lib').Xo
|
var Xo = require('xo-lib').default
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
@ -43,10 +43,10 @@ function connect () {
|
|||||||
throw new Error('no token available')
|
throw new Error('no token available')
|
||||||
}
|
}
|
||||||
|
|
||||||
var xo = new Xo(config.server)
|
var xo = new Xo({ url: config.server })
|
||||||
|
|
||||||
return xo.signIn({
|
return xo.open().then(function () {
|
||||||
token: config.token
|
return xo.signIn({ token: config.token })
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return xo
|
return xo
|
||||||
})
|
})
|
||||||
@ -180,10 +180,8 @@ exports = module.exports = main
|
|||||||
exports.help = help
|
exports.help = help
|
||||||
|
|
||||||
function register (args) {
|
function register (args) {
|
||||||
var xo
|
var xo = new Xo({ url: args[0] })
|
||||||
return Bluebird.try(function () {
|
return xo.open().then(function () {
|
||||||
xo = new Xo(args[0])
|
|
||||||
|
|
||||||
return xo.signIn({
|
return xo.signIn({
|
||||||
email: args[1],
|
email: args[1],
|
||||||
password: args[2]
|
password: args[2]
|
||||||
@ -293,7 +291,7 @@ function call (args) {
|
|||||||
var baseUrl
|
var baseUrl
|
||||||
return connect().then(function (xo) {
|
return connect().then(function (xo) {
|
||||||
// FIXME: do not use private properties.
|
// FIXME: do not use private properties.
|
||||||
baseUrl = xo._api._url.replace(/^ws/, 'http')
|
baseUrl = xo._url.replace(/^ws/, 'http')
|
||||||
|
|
||||||
return xo.call(method, params)
|
return xo.call(method, params)
|
||||||
}).then(function handleResult (result) {
|
}).then(function handleResult (result) {
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
"pretty-ms": "^2.1.0",
|
"pretty-ms": "^2.1.0",
|
||||||
"progress-stream": "^1.1.1",
|
"progress-stream": "^1.1.1",
|
||||||
"xdg-basedir": "^2.0.0",
|
"xdg-basedir": "^2.0.0",
|
||||||
"xo-lib": "^0.7.3"
|
"xo-lib": "^0.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"standard": "^8.1.0"
|
"standard": "^8.1.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user