remove logging
This commit is contained in:
9
index.js
9
index.js
@@ -182,7 +182,7 @@ instance.prototype.action = function (action) {
|
|||||||
case 'startNewTimer': {
|
case 'startNewTimer': {
|
||||||
self.getCurrentTimer().then((timerId) => {
|
self.getCurrentTimer().then((timerId) => {
|
||||||
self.log('debug', 'Current timer id ' + timerId)
|
self.log('debug', 'Current timer id ' + timerId)
|
||||||
if (timerId === undefined || timerId == null || self.config.alwaysStart == true) {
|
if (timerId === undefined || timerId === null || self.config.alwaysStart === true) {
|
||||||
var cmd = 'https://api.track.toggl.com/api/v8/time_entries/start'
|
var cmd = 'https://api.track.toggl.com/api/v8/time_entries/start'
|
||||||
if (opt.project == '0') {
|
if (opt.project == '0') {
|
||||||
var body = '{"time_entry":{"description":"' + opt.description + '","created_with":"companion"}}'
|
var body = '{"time_entry":{"description":"' + opt.description + '","created_with":"companion"}}'
|
||||||
@@ -195,7 +195,7 @@ instance.prototype.action = function (action) {
|
|||||||
'"}}'
|
'"}}'
|
||||||
}
|
}
|
||||||
self.sendCommand('rest', cmd, body).then((result) => {
|
self.sendCommand('rest', cmd, body).then((result) => {
|
||||||
if (typeof result == 'object' && result.data !== null && result.data !== undefined) {
|
if (typeof result === 'object' && result.data !== null && result.data !== undefined) {
|
||||||
self.log('debug', 'New timer started ' + result.data.id)
|
self.log('debug', 'New timer started ' + result.data.id)
|
||||||
} else {
|
} else {
|
||||||
self.log('warn', 'Error starting timer')
|
self.log('warn', 'Error starting timer')
|
||||||
@@ -213,7 +213,7 @@ instance.prototype.action = function (action) {
|
|||||||
if (timerId !== null && timerId !== undefined) {
|
if (timerId !== null && timerId !== undefined) {
|
||||||
var cmd = 'https://api.track.toggl.com/api/v8/time_entries/' + timerId + '/stop'
|
var cmd = 'https://api.track.toggl.com/api/v8/time_entries/' + timerId + '/stop'
|
||||||
self.sendCommand('rest_put', cmd).then((result) => {
|
self.sendCommand('rest_put', cmd).then((result) => {
|
||||||
if (typeof result == 'object' && result.data !== null && result.data !== undefined) {
|
if (typeof result === 'object' && result.data !== null && result.data !== undefined) {
|
||||||
self.log('debug', 'Stopped ' + result.data.id + ', duration ' + result.data.duration)
|
self.log('debug', 'Stopped ' + result.data.id + ', duration ' + result.data.duration)
|
||||||
} else {
|
} else {
|
||||||
self.log('warn', 'Error stopping timer')
|
self.log('warn', 'Error stopping timer')
|
||||||
@@ -335,14 +335,11 @@ instance.prototype.getCurrentTimer = function () {
|
|||||||
(result) => {
|
(result) => {
|
||||||
if (typeof result === 'object' && result.data !== null && result.data !== undefined) {
|
if (typeof result === 'object' && result.data !== null && result.data !== undefined) {
|
||||||
if ('id' in result.data) {
|
if ('id' in result.data) {
|
||||||
console.log('current timer: ' + result.data.id)
|
|
||||||
resolve(result.data.id)
|
resolve(result.data.id)
|
||||||
} else {
|
} else {
|
||||||
console.log('getCurrentTimer: No timer id found')
|
|
||||||
resolve(null)
|
resolve(null)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('getCurrentTimer: No timer running')
|
|
||||||
resolve(null)
|
resolve(null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user