Skip to content

Instantly share code, notes, and snippets.

@chrillo
Created October 11, 2015 16:22
Show Gist options
  • Save chrillo/8ffb2e31d2c734b07ffb to your computer and use it in GitHub Desktop.
Save chrillo/8ffb2e31d2c734b07ffb to your computer and use it in GitHub Desktop.
/**
* AWS Module: Action: Modularized Code
*/
var config = require('../../../config')
var Auth = require('../../../lib/auth')
var Toggl = require('../../../lib/toggl')
var TogglSync = require('../../../lib/togglSync')
var toggl = new Toggl(config.toggl)
var togglSync = new TogglSync({toggl: toggl})
// Export For Lambda Handler
module.exports.run = function(event, context, cb) {
Auth.getSession(event.access_token)
.then(function(session){
return togglSync.syncWorkspaces()
})
.then(function(res){
cb(null, res)
})
.catch(function(e){
cb(e, null)
})
}
// Your Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment