Created
October 11, 2015 16:22
-
-
Save chrillo/8ffb2e31d2c734b07ffb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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