Prettified Code!
This commit is contained in:
30
index.js
30
index.js
@@ -44,7 +44,6 @@ instance.prototype.auth = function () {
|
||||
self.header['Authorization'] = 'Basic ' + auth
|
||||
|
||||
console.log(self.header)
|
||||
|
||||
}
|
||||
|
||||
instance.prototype.config_fields = function () {
|
||||
@@ -92,7 +91,7 @@ instance.prototype.init_presets = function () {
|
||||
action: 'startNewTimer',
|
||||
options: {
|
||||
description: '',
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
@@ -180,14 +179,17 @@ instance.prototype.action = function (action) {
|
||||
break
|
||||
}
|
||||
|
||||
self.system.emit(restCmd, cmd, body, function (err, result) {
|
||||
|
||||
self.system.emit(
|
||||
restCmd,
|
||||
cmd,
|
||||
body,
|
||||
function (err, result) {
|
||||
if (err !== null) {
|
||||
console.log(result.statusCode)
|
||||
console.log('HTTP Request failed (' + result.error.code + ')')
|
||||
self.status(self.STATUS_ERROR, result.error.code);
|
||||
self.status(self.STATUS_ERROR, result.error.code)
|
||||
} else {
|
||||
console.log(typeof(result.data))
|
||||
console.log(typeof result.data)
|
||||
console.log(result.statusCode)
|
||||
if (!self.auth_error) {
|
||||
self.status(self.STATUS_OK)
|
||||
@@ -202,15 +204,19 @@ instance.prototype.action = function (action) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, self.header)
|
||||
|
||||
},
|
||||
self.header
|
||||
)
|
||||
}
|
||||
|
||||
instance.prototype.getCurrentTimer = function () {
|
||||
var self = this
|
||||
var cmd = 'https://api.track.toggl.com/api/v8/time_entries/current'
|
||||
|
||||
self.system.emit('rest_get', cmd, function (err, result) {
|
||||
self.system.emit(
|
||||
'rest_get',
|
||||
cmd,
|
||||
function (err, result) {
|
||||
if (err !== null) {
|
||||
console.log('HTTP Request failed (' + result.error.code + ')')
|
||||
self.status(self.STATUS_ERROR, result.error.code)
|
||||
@@ -234,11 +240,13 @@ instance.prototype.getCurrentTimer = function () {
|
||||
self.log('warn', 'Unable to connect to toggl, check your API token is correct')
|
||||
self.currentTimer = null
|
||||
}
|
||||
}, self.header)
|
||||
},
|
||||
self.header
|
||||
)
|
||||
}
|
||||
|
||||
instance.prototype.interpretData = function (data) {
|
||||
var self = this;
|
||||
var self = this
|
||||
|
||||
console.log(data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user